Skip to content

Commit e10fa66

Browse files
committed
echobot: simplify handling messageless updates
1 parent deb9de0 commit e10fa66

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

examples/echobot.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,10 @@ def echo(bot):
4343
# chat_id is required to reply to any message
4444
chat_id = update.message.chat_id
4545
update_id = update.update_id + 1
46-
if not update.message: # we ignore updates without messages
47-
continue
48-
message = update.message.text
4946

50-
if message:
47+
if update.message: # your bot can receive updates without messages
5148
# Reply to the message
52-
bot.sendMessage(chat_id=chat_id, text=message)
49+
bot.sendMessage(chat_id=chat_id, text=update.message.text)
5350

5451

5552
if __name__ == '__main__':

0 commit comments

Comments
 (0)