diff --git a/telebot/asyncio_storage/pickle_storage.py b/telebot/asyncio_storage/pickle_storage.py index 4928d4a..49fe3be 100644 --- a/telebot/asyncio_storage/pickle_storage.py +++ b/telebot/asyncio_storage/pickle_storage.py @@ -51,9 +51,11 @@ class StatePickleStorage(StateStorageBase): if chat_id in self.data: if user_id in self.data[chat_id]: self.data[chat_id][user_id]['state'] = state + self.update_data() return True else: self.data[chat_id][user_id] = {'state': state, 'data': {}} + self.update_data() return True self.data[chat_id] = {user_id: {'state': state, 'data': {}}} self.update_data() diff --git a/telebot/storage/pickle_storage.py b/telebot/storage/pickle_storage.py index 39b10a3..ff72ac3 100644 --- a/telebot/storage/pickle_storage.py +++ b/telebot/storage/pickle_storage.py @@ -57,9 +57,11 @@ class StatePickleStorage(StateStorageBase): if chat_id in self.data: if user_id in self.data[chat_id]: self.data[chat_id][user_id]['state'] = state + self.update_data() return True else: self.data[chat_id][user_id] = {'state': state, 'data': {}} + self.update_data() return True self.data[chat_id] = {user_id: {'state': state, 'data': {}}} self.update_data()