Skip to content

Commit 15d2879

Browse files
author
mostafaqanbaryan
authored
Update __init__.py
Add clear_step_handler() for resetting bot
1 parent 064b84a commit 15d2879

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎telebot/__init__.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,15 @@ def register_next_step_handler(self, message, callback):
998998
self.pre_message_subscribers_next_step[chat_id].append(callback)
999999
else:
10001000
self.pre_message_subscribers_next_step[chat_id] = [callback]
1001+
1002+
def clear_step_handler(self, message):
1003+
"""
1004+
Clears all callback functions registered by register_next_step_handler().
1005+
1006+
:param message: The message for which we want to handle new message after that in same chat.
1007+
"""
1008+
chat_id = message.chat.id
1009+
self.pre_message_subscribers_next_step[chat_id] = []
10011010

10021011
def _notify_message_next_handler(self, new_messages):
10031012
for message in new_messages:

0 commit comments

Comments
 (0)