mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
Updated Types of Handlers (markdown)
parent
053ee77b22
commit
834f450a66
1 changed files with 8 additions and 1 deletions
|
@ -1 +1,8 @@
|
||||||
TODO
|
A `Handler` is an instance derived from the base class [telegram.ext.Handler](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.handler.html#telegram.ext.Handler) which is responsible for the routing of different kinds of updates (text, audio, inlinequery, button presses, ...) to their _corresponding callback function_ in your code.
|
||||||
|
For example, if you want your bot to respond to the command `/start`, you can use a [CommandHandler](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.commandhandler.html) that maps the input to a callback:
|
||||||
|
```
|
||||||
|
def my_start_callback(bot, update):
|
||||||
|
update.message.reply_text("Welcome to my awesome bot!")
|
||||||
|
|
||||||
|
...
|
||||||
|
dispatcher.add_handler(CommandHandler("start", my_callback))```
|
Loading…
Reference in a new issue