Telegram::BotKit - Set of Perl classes for creation of interactive and dynamic Telegram bots. Now bots can only process text, but work in progress :)
version 0.03
Allows to create a simple bots for house even for housewife
screen = text [and/or] image [and/or] document [and/or] voice [and/or] location [and/or] reply markup
Screens can be shown just according sequence in JSON or can depends on previous user reply (callback_msg property)
Bot can automatically control is last user reply valid and show pre-defined message if reply is not valid
At last screen bot is calling some perl function that uses some external API.
Bot store sequence of user inputs and can process data before calling serialize function
For convenience
Here is example of simple booking bot
{ "screens" : [ { "name": "item_select", "start_command": "/book", "welcome_msg": "Please select an item to book", "keyboard": [ { "key": "Item 1", "answ" : "Good" }, { "key": "Item 2", "answ" : "Well" }, { "key": "Item 3", "answ" : "Fine" } ] }, { "name": "day_select", "parent": "item_select", "welcome_msg": "Please select a day", "keyboard": [ { "key": "today" }, { "key": "tomorrow" } ] }, { "name": "time_range_select", "parent": "day_select", "welcome_msg": "Please select atime range", "keyboard": [ { "key": "morning", "answ" : "You are early bird" }, { "key": "day", "answ" : "Good choice" }, { "key": "evening", "answ" : "Owl" } ] }, { "name": "morning_time_range_select", "parent": "time_range_select", "callback_msg": "morning", "kb_build_func": "dynamic1_build_func" }, { "name": "dynamic2", "parent": "time_range_select", "callback_msg": "day", "kb_build_func": "dynamic2_build_func" }, { "name": "info", "start_command": "/info", "welcome_msg": "Get info", "kb_build_func": "info_build_func" } ] }
Pavel Serikov <pavelsr@cpan.org>
This software is copyright (c) 2017 by Pavel Serikov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Telegram::BotKit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Telegram::BotKit
CPAN shell
perl -MCPAN -e shell install Telegram::BotKit
For more information on module installation, please visit the detailed CPAN module installation guide.