mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 22:45:09 +01:00
echobot: simplify handling messageless updates
This commit is contained in:
parent
deb9de0ba0
commit
e10fa66286
1 changed files with 2 additions and 5 deletions
|
@ -43,13 +43,10 @@ def echo(bot):
|
||||||
# chat_id is required to reply to any message
|
# chat_id is required to reply to any message
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
update_id = update.update_id + 1
|
update_id = update.update_id + 1
|
||||||
if not update.message: # we ignore updates without messages
|
|
||||||
continue
|
|
||||||
message = update.message.text
|
|
||||||
|
|
||||||
if message:
|
if update.message: # your bot can receive updates without messages
|
||||||
# Reply to the message
|
# Reply to the message
|
||||||
bot.sendMessage(chat_id=chat_id, text=message)
|
bot.sendMessage(chat_id=chat_id, text=update.message.text)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue