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

Code base cleanup

This commit is contained in:
Badiboy
2022-01-24 22:38:35 +03:00
parent 2e9947277a
commit 4166fb229e
16 changed files with 52 additions and 97 deletions

View File

@@ -43,11 +43,10 @@ class StateStorageBase:
async def get_state(self, chat_id, user_id):
raise NotImplementedError
async def save(chat_id, user_id, data):
async def save(self, chat_id, user_id, data):
raise NotImplementedError
class StateContext:
"""
Class for data.

View File

@@ -1,4 +1,3 @@
from pickle import FALSE
from telebot.asyncio_storage.base_storage import StateStorageBase, StateContext
import json
@@ -93,7 +92,6 @@ class StateRedisStorage(StateStorageBase):
return True
return False
async def get_value(self, chat_id, user_id, key):
"""
Get value for a data of a user in a chat.
@@ -105,7 +103,6 @@ class StateRedisStorage(StateStorageBase):
if key in response[user_id]['data']:
return response[user_id]['data'][key]
return None
async def get_state(self, chat_id, user_id):
"""
@@ -119,7 +116,6 @@ class StateRedisStorage(StateStorageBase):
return None
async def get_data(self, chat_id, user_id):
"""
Get data of particular user in a particular chat.
@@ -131,7 +127,6 @@ class StateRedisStorage(StateStorageBase):
return response[user_id]['data']
return None
async def reset_data(self, chat_id, user_id):
"""
Reset data of a user in a chat.
@@ -144,9 +139,6 @@ class StateRedisStorage(StateStorageBase):
await self.set_record(chat_id, response)
return True
async def set_data(self, chat_id, user_id, key, value):
"""
Set data without interactive data.
@@ -175,4 +167,3 @@ class StateRedisStorage(StateStorageBase):
response[user_id]['data'] = dict(data, **response[user_id]['data'])
await self.set_record(chat_id, response)
return True