diff --git a/AUTHORS.rst b/AUTHORS.rst index b1542220c..55a05b75b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -14,6 +14,7 @@ The following wonderful people contributed directly or indirectly to this projec - `JASON0916 `_ - `JRoot3D `_ - `macrojames `_ +- `Rahiel Kasim `_ - `sooyhwang `_ - `wjt `_ diff --git a/examples/echobot.py b/examples/echobot.py index 10c98083c..67b3c5527 100644 --- a/examples/echobot.py +++ b/examples/echobot.py @@ -19,7 +19,6 @@ import logging import telegram -import time LAST_UPDATE_ID = None @@ -43,14 +42,13 @@ def main(): while True: echo(bot) - time.sleep(3) def echo(bot): global LAST_UPDATE_ID # Request updates after the last updated_id - for update in bot.getUpdates(offset=LAST_UPDATE_ID): + for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10): # chat_id is required to reply any message chat_id = update.message.chat_id message = update.message.text.encode('utf-8') diff --git a/examples/roboed.py b/examples/roboed.py index 7cf070988..93cd95178 100644 --- a/examples/roboed.py +++ b/examples/roboed.py @@ -33,7 +33,7 @@ def main(): LAST_UPDATE_ID = bot.getUpdates()[-1].update_id # Get lastest update while True: - for update in bot.getUpdates(offset=LAST_UPDATE_ID): + for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10): text = update.message.text chat_id = update.message.chat.id update_id = update.update_id