mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Update __init__.py
I find bug when I use your library without threading. If call bot.register_next_step_handler in function that register next_handler in next_step_handlers but in function _notify_next_handlers this delete and bot don`t have handler, but in threading mode function self.next_step_handlers.pop(chat_id, None) has time to eval self.next_step_handlers.pop(chat_id, None) and bug disappear. Sorry for my English
This commit is contained in:
parent
8bc5b74495
commit
2b822f782d
@ -6,6 +6,7 @@ import time
|
||||
import re
|
||||
import sys
|
||||
import six
|
||||
import copy
|
||||
|
||||
import logging
|
||||
|
||||
@ -1155,13 +1156,13 @@ class TeleBot:
|
||||
chat_id = message.chat.id
|
||||
was_poped = False
|
||||
if chat_id in self.next_step_handlers.keys():
|
||||
handlers = self.next_step_handlers[chat_id]
|
||||
handlers = copy.deepcopy(self.next_step_handlers[chat_id])
|
||||
self.next_step_handlers.pop(chat_id, None)
|
||||
if (handlers):
|
||||
for handler in handlers:
|
||||
self._exec_task(handler["callback"], message, *handler["args"], **handler["kwargs"])
|
||||
new_messages.pop(i) # removing message that detects with next_step_handler
|
||||
was_poped = True
|
||||
self.next_step_handlers.pop(chat_id, None)
|
||||
if (not was_poped):
|
||||
i += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user