⚠️ Project is in active development and not intended for any serious application
Framework for making bot from config files (we all love YAML, does't we?)
- Automatic back button configuration - not need to plainly think about branching
- Beautiful inline buttons experience - previous message gets updated on button pressed (much cleaner message history)
- RegEx message filters
$ pip install autobot-tg # or: pipx install autobot-tg
$ autobot-tg --helpBefore starting the bot, you have to specify bot token with env variable BOT_TOKEN
autobot examples/configs/simple.yamlCore elements of schema is:
states- describes possible bot states (nodes in network graph)transitions- describes transitions between states (edges)
States can be represented as array of named elements:
<state name>text(required) - text message that the bot will send when entering the statecommand(optional) - specifies the command that will trigger state (for example/start)add_back_button(optional) - whether state should have back button (yes or no)inline_buttons(optional) - describes inline buttons of this staterow(required) - buttons in one row (array)text- inline button textcallback_data- data that will be sent on button pressed
Transitions is an array of elements with these fields:
from(required) - source state. Transition will be triggered only if bot is in this state. Must be present in states schemato(required) - target state. Must be present in states schemaconditions(required) - under what conditions the transition will be triggered. Possible conditions:message(array of regex) - transition will be triggered on message sent. Applies regex filter to user's message. If filter passes - transition is triggered (for example.+will always trigger transition)data(array of strings) - transition will be triggered if specified callback data will be sent (when user presses the inline button)else(string - name of state) - trigger transition if no other conditions are satisfied. Must be valid state namealways(no parameters) - always triggers transition. When bot entersfromstate, it will instantly entertostate
