mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 00:27:46 +01:00
Revert 118cef89453eb673ced073ed1b276d3f92a0ffd3...76b75ab5c608d6689dd67baa70fcb32a000dc341 on Extensions – Your first Bot
parent
76b75ab5c6
commit
9fb009ecf6
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue