diff --git a/examples/arbitrarycallbackdatabot.py b/examples/arbitrarycallbackdatabot.py index 3fca2c5fee7..392c6772894 100644 --- a/examples/arbitrarycallbackdatabot.py +++ b/examples/arbitrarycallbackdatabot.py @@ -122,7 +122,7 @@ def main() -> None: application.add_handler(CallbackQueryHandler(list_button)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/contexttypesbot.py b/examples/contexttypesbot.py index 17f8fb90f34..30dc967538f 100644 --- a/examples/contexttypesbot.py +++ b/examples/contexttypesbot.py @@ -147,7 +147,7 @@ def main() -> None: application.add_handler(CallbackQueryHandler(count_click)) application.add_handler(CommandHandler("print_users", print_users)) - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/conversationbot.py b/examples/conversationbot.py index 84c9accde5b..b846e36695e 100644 --- a/examples/conversationbot.py +++ b/examples/conversationbot.py @@ -169,7 +169,7 @@ def main() -> None: application.add_handler(conv_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/conversationbot2.py b/examples/conversationbot2.py index 14491bf5e23..efb809e175a 100644 --- a/examples/conversationbot2.py +++ b/examples/conversationbot2.py @@ -157,7 +157,7 @@ def main() -> None: application.add_handler(conv_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/customwebhookbot.py b/examples/customwebhookbot.py index c129e41eb14..f9539dfe3c7 100644 --- a/examples/customwebhookbot.py +++ b/examples/customwebhookbot.py @@ -129,7 +129,7 @@ async def main() -> None: application.add_handler(TypeHandler(type=WebhookUpdate, callback=webhook_update)) # Pass webhook settings to telegram - await application.bot.set_webhook(url=f"{url}/telegram") + await application.bot.set_webhook(url=f"{url}/telegram", allowed_updates=Update.ALL_TYPES) # Set up webserver async def telegram(request: Request) -> Response: diff --git a/examples/deeplinking.py b/examples/deeplinking.py index 025ed513f3e..63941916b36 100644 --- a/examples/deeplinking.py +++ b/examples/deeplinking.py @@ -144,7 +144,7 @@ def main() -> None: application.add_handler(CommandHandler("start", start)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/echobot.py b/examples/echobot.py index 6aa369cae68..3c06e799c2a 100644 --- a/examples/echobot.py +++ b/examples/echobot.py @@ -74,7 +74,7 @@ def main() -> None: application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/errorhandlerbot.py b/examples/errorhandlerbot.py index 1152dc6daab..0b6620f565a 100644 --- a/examples/errorhandlerbot.py +++ b/examples/errorhandlerbot.py @@ -90,7 +90,7 @@ def main() -> None: application.add_error_handler(error_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/inlinebot.py b/examples/inlinebot.py index 14310a6ea53..8ec2cbc52ed 100644 --- a/examples/inlinebot.py +++ b/examples/inlinebot.py @@ -99,7 +99,7 @@ def main() -> None: application.add_handler(InlineQueryHandler(inline_query)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/inlinekeyboard.py b/examples/inlinekeyboard.py index 517f810b493..d21a9c1d938 100644 --- a/examples/inlinekeyboard.py +++ b/examples/inlinekeyboard.py @@ -72,7 +72,7 @@ def main() -> None: application.add_handler(CommandHandler("help", help_command)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/inlinekeyboard2.py b/examples/inlinekeyboard2.py index d40381588c7..2f57b7fe0de 100644 --- a/examples/inlinekeyboard2.py +++ b/examples/inlinekeyboard2.py @@ -204,7 +204,7 @@ def main() -> None: application.add_handler(conv_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/nestedconversationbot.py b/examples/nestedconversationbot.py index 684ee157a84..2a4a7915251 100644 --- a/examples/nestedconversationbot.py +++ b/examples/nestedconversationbot.py @@ -392,7 +392,7 @@ def main() -> None: application.add_handler(conv_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/passportbot.py b/examples/passportbot.py index 77281e85e22..d0669bd24de 100644 --- a/examples/passportbot.py +++ b/examples/passportbot.py @@ -129,7 +129,7 @@ def main() -> None: application.add_handler(MessageHandler(filters.PASSPORT_DATA, msg)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/paymentbot.py b/examples/paymentbot.py index d2206b7be43..23b077bb606 100644 --- a/examples/paymentbot.py +++ b/examples/paymentbot.py @@ -165,7 +165,7 @@ def main() -> None: ) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/persistentconversationbot.py b/examples/persistentconversationbot.py index cd62cf7c65d..22db5f45265 100644 --- a/examples/persistentconversationbot.py +++ b/examples/persistentconversationbot.py @@ -180,7 +180,7 @@ def main() -> None: application.add_handler(show_data_handler) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/pollbot.py b/examples/pollbot.py index 9b41832b265..f7a49088a99 100644 --- a/examples/pollbot.py +++ b/examples/pollbot.py @@ -179,7 +179,7 @@ def main() -> None: application.add_handler(PollHandler(receive_quiz_answer)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/rawapibot.py b/examples/rawapibot.py index 54b1fff3999..03c8a548b88 100644 --- a/examples/rawapibot.py +++ b/examples/rawapibot.py @@ -24,7 +24,7 @@ f"{TG_VER} version of this example, " f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html" ) -from telegram import Bot +from telegram import Bot, Update from telegram.error import Forbidden, NetworkError logging.basicConfig( @@ -58,7 +58,7 @@ async def main() -> NoReturn: async def echo(bot: Bot, update_id: int) -> int: """Echo the message the user sent.""" # Request updates after the last update_id - updates = await bot.get_updates(offset=update_id, timeout=10) + updates = await bot.get_updates(offset=update_id, timeout=10, allowed_updates=Update.ALL_TYPES) for update in updates: next_update_id = update.update_id + 1 diff --git a/examples/timerbot.py b/examples/timerbot.py index 9c49b558816..3c9e7a742a5 100644 --- a/examples/timerbot.py +++ b/examples/timerbot.py @@ -114,7 +114,7 @@ def main() -> None: application.add_handler(CommandHandler("unset", unset)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__": diff --git a/examples/webappbot.py b/examples/webappbot.py index 011d9dae6d1..4a2198012bd 100644 --- a/examples/webappbot.py +++ b/examples/webappbot.py @@ -70,7 +70,7 @@ def main() -> None: application.add_handler(MessageHandler(filters.StatusUpdate.WEB_APP_DATA, web_app_data)) # Run the bot until the user presses Ctrl-C - application.run_polling() + application.run_polling(allowed_updates=Update.ALL_TYPES) if __name__ == "__main__":