From 0fecf4620194208ca3ce488b290e184af8be40ab Mon Sep 17 00:00:00 2001 From: _run Date: Tue, 11 Oct 2022 19:09:59 +0400 Subject: [PATCH] Create continue_handling.py --- examples/continue_handling.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/continue_handling.py diff --git a/examples/continue_handling.py b/examples/continue_handling.py new file mode 100644 index 0000000..68e26f1 --- /dev/null +++ b/examples/continue_handling.py @@ -0,0 +1,23 @@ +from telebot import TeleBot +from telebot.handler_backends import ContinueHandling + + +bot = TeleBot('TOKEN') + +@bot.message_handler(commands=['start']) +def start(message): + bot.send_message(message.chat.id, 'Hello World!') + return ContinueHandling() + +@bot.message_handler(commands=['start']) +def start2(message): + """ + This handler comes after the first one, but it will never be called. + But you can call it by returning ContinueHandling() in the first handler. + + If you return ContinueHandling() in the first handler, the next + registered handler with appropriate filters will be called. + """ + bot.send_message(message.chat.id, 'Hello World2!') + +bot.infinity_polling()