Skip to content

Commit

Permalink
Fix bug with unsaving data
Browse files Browse the repository at this point in the history
  • Loading branch information
coder2020official committed Jun 4, 2022
1 parent 8da749e commit e689e96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions telebot/asyncio_storage/pickle_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions telebot/storage/pickle_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e689e96

Please sign in to comment.