1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Fix States

This commit is contained in:
_run
2022-02-02 14:44:02 +04:00
parent 7d2915c7f9
commit cd4a9add68
9 changed files with 29 additions and 1 deletions

View File

@ -8,6 +8,8 @@ class StateMemoryStorage(StateStorageBase):
async def set_state(self, chat_id, user_id, state):
if isinstance(state, object):
state = state.name
if chat_id in self.data:
if user_id in self.data[chat_id]:
self.data[chat_id][user_id]['state'] = state

View File

@ -47,6 +47,8 @@ class StatePickleStorage(StateStorageBase):
file.close()
async def set_state(self, chat_id, user_id, state):
if isinstance(state, object):
state = state.name
if chat_id in self.data:
if user_id in self.data[chat_id]:
self.data[chat_id][user_id]['state'] = state

View File

@ -65,6 +65,8 @@ class StateRedisStorage(StateStorageBase):
"""
response = await self.get_record(chat_id)
user_id = str(user_id)
if isinstance(state, object):
state = state.name
if response:
if user_id in response:
response[user_id]['state'] = state