diff --git a/telebot/asyncio_storage/pickle_storage.py b/telebot/asyncio_storage/pickle_storage.py index 4928d4a1b..49fe3bedd 100644 --- a/telebot/asyncio_storage/pickle_storage.py +++ b/telebot/asyncio_storage/pickle_storage.py @@ -51,9 +51,11 @@ async def set_state(self, chat_id, user_id, state): 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 39b10a3aa..ff72ac3b6 100644 --- a/telebot/storage/pickle_storage.py +++ b/telebot/storage/pickle_storage.py @@ -57,9 +57,11 @@ def set_state(self, chat_id, user_id, state): 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()