Revert 118cef89453eb673ced073ed1b276d3f92a0ffd3...76b75ab5c608d6689dd67baa70fcb32a000dc341 on Extensions – Your first Bot

Eldinnie 2019-06-17 16:22:49 +02:00
parent 76b75ab5c6
commit 9fb009ecf6

@ -76,7 +76,7 @@ But our Bot can now only answer to the `/start` command. Let's add another handl
```python ```python
def echo(update, context): def echo(update, context):
update.send_message(chat_id=context.message.chat_id, text=context.message.text) context.bot.send_message(chat_id=update.message.chat_id, text=update.message.text)
from telegram.ext import MessageHandler, Filters from telegram.ext import MessageHandler, Filters
echo_handler = MessageHandler(Filters.text, echo) echo_handler = MessageHandler(Filters.text, echo)
@ -95,7 +95,7 @@ Let's add some actual functionality to your bot. We want to implement a `/caps`
```python ```python
def caps(update, context): def caps(update, context):
text_caps = ' '.join(context.args).upper() text_caps = ' '.join(context.args).upper()
update.send_message(chat_id=context.message.chat_id, text=text_caps) context.bot.send_message(chat_id=update.message.chat_id, text=text_caps)
caps_handler = CommandHandler('caps', caps) caps_handler = CommandHandler('caps', caps)
dispatcher.add_handler(caps_handler) dispatcher.add_handler(caps_handler)