Skip to content

Commit

Permalink
Merge pull request #1575 from coder2020official/bugfixes
Browse files Browse the repository at this point in the history
Fix bug with unsaving data
  • Loading branch information
Badiboy authored Jun 4, 2022
2 parents 808810e + e689e96 commit a21ab20
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 a21ab20

Please sign in to comment.