mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Typos fixes
This commit is contained in:
parent
9deb95a9ea
commit
6d14790e1c
1 changed files with 47 additions and 46 deletions
|
|
@ -12,13 +12,14 @@ THROTTLE_MANAGER = '$throttle_manager'
|
||||||
|
|
||||||
class BaseStorage:
|
class BaseStorage:
|
||||||
"""
|
"""
|
||||||
In states-storage you can save current user state and data for all steps
|
You are able to save current user's state
|
||||||
|
and data for all steps in states-storage
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
"""
|
"""
|
||||||
Need override this method and use when application is shutdowns.
|
You have to override this method and use when application shutdowns.
|
||||||
You can save data or etc.
|
Perhaps you would like to save data and etc.
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
@ -26,7 +27,7 @@ class BaseStorage:
|
||||||
|
|
||||||
async def wait_closed(self):
|
async def wait_closed(self):
|
||||||
"""
|
"""
|
||||||
You need override this method for all asynchronously storage's like Redis.
|
You have to override this method for all asynchronous storages (e.g., Redis).
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
@ -37,34 +38,33 @@ class BaseStorage:
|
||||||
chat: typing.Union[str, int, None] = None,
|
chat: typing.Union[str, int, None] = None,
|
||||||
user: typing.Union[str, int, None] = None) -> (typing.Union[str, int], typing.Union[str, int]):
|
user: typing.Union[str, int, None] = None) -> (typing.Union[str, int], typing.Union[str, int]):
|
||||||
"""
|
"""
|
||||||
In all methods of storage chat or user is always required.
|
In all storage's methods chat or user is always required.
|
||||||
If one of this is not presented, need set the missing value based on the presented.
|
If one of them is not provided, you have to set missing value based on the provided one.
|
||||||
|
|
||||||
This method performs the above action.
|
This method performs the check described above.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if chat is not None and user is not None:
|
if chat is None and user is None:
|
||||||
return chat, user
|
raise ValueError('`user` or `chat` parameter is required but no one is provided!')
|
||||||
elif user is None and chat is not None:
|
|
||||||
|
if user is None and chat is not None:
|
||||||
user = chat
|
user = chat
|
||||||
return chat, user
|
|
||||||
elif user is not None and chat is None:
|
elif user is not None and chat is None:
|
||||||
chat = user
|
chat = user
|
||||||
return chat, user
|
return chat, user
|
||||||
raise ValueError('User or chat parameters is required but anyone is not presented!')
|
|
||||||
|
|
||||||
async def get_state(self, *,
|
async def get_state(self, *,
|
||||||
chat: typing.Union[str, int, None] = None,
|
chat: typing.Union[str, int, None] = None,
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
default: typing.Optional[str] = None) -> typing.Optional[str]:
|
default: typing.Optional[str] = None) -> typing.Optional[str]:
|
||||||
"""
|
"""
|
||||||
Get current state of user in chat. Return value stored in `default` parameter if record is not found.
|
Get current state of user in chat. Return `default` if no record is found.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -78,10 +78,10 @@ class BaseStorage:
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
default: typing.Optional[typing.Dict] = None) -> typing.Dict:
|
default: typing.Optional[typing.Dict] = None) -> typing.Dict:
|
||||||
"""
|
"""
|
||||||
Get state-data for user in chat. Return `default` if data is not presented in storage.
|
Get state-data for user in chat. Return `default` if no data is provided in storage.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -95,10 +95,10 @@ class BaseStorage:
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
state: typing.Optional[typing.AnyStr] = None):
|
state: typing.Optional[typing.AnyStr] = None):
|
||||||
"""
|
"""
|
||||||
Setup new state for user in chat
|
Set new state for user in chat
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -113,8 +113,8 @@ class BaseStorage:
|
||||||
"""
|
"""
|
||||||
Set data for user in chat
|
Set data for user in chat
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -132,8 +132,8 @@ class BaseStorage:
|
||||||
|
|
||||||
You can use data parameter or|and kwargs.
|
You can use data parameter or|and kwargs.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param data:
|
:param data:
|
||||||
:param chat:
|
:param chat:
|
||||||
|
|
@ -147,10 +147,10 @@ class BaseStorage:
|
||||||
chat: typing.Union[str, int, None] = None,
|
chat: typing.Union[str, int, None] = None,
|
||||||
user: typing.Union[str, int, None] = None):
|
user: typing.Union[str, int, None] = None):
|
||||||
"""
|
"""
|
||||||
Reset data dor user in chat.
|
Reset data for user in chat.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -163,10 +163,11 @@ class BaseStorage:
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
with_data: typing.Optional[bool] = True):
|
with_data: typing.Optional[bool] = True):
|
||||||
"""
|
"""
|
||||||
Reset state for user in chat. You can use this method for finish conversations.
|
Reset state for user in chat.
|
||||||
|
You may desire to use this method when finishing conversations.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of this is not presented,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -184,8 +185,8 @@ class BaseStorage:
|
||||||
"""
|
"""
|
||||||
Finish conversation for user in chat.
|
Finish conversation for user in chat.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -201,10 +202,10 @@ class BaseStorage:
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
default: typing.Optional[dict] = None) -> typing.Dict:
|
default: typing.Optional[dict] = None) -> typing.Dict:
|
||||||
"""
|
"""
|
||||||
Get state-data for user in chat. Return `default` if data is not presented in storage.
|
Get bucket for user in chat. Return `default` if no data is provided in storage.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -218,10 +219,10 @@ class BaseStorage:
|
||||||
user: typing.Union[str, int, None] = None,
|
user: typing.Union[str, int, None] = None,
|
||||||
bucket: typing.Dict = None):
|
bucket: typing.Dict = None):
|
||||||
"""
|
"""
|
||||||
Set data for user in chat
|
Set bucket for user in chat
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
@ -235,12 +236,12 @@ class BaseStorage:
|
||||||
bucket: typing.Dict = None,
|
bucket: typing.Dict = None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""
|
||||||
Update data for user in chat
|
Update bucket for user in chat
|
||||||
|
|
||||||
You can use data parameter or|and kwargs.
|
You can use bucket parameter or|and kwargs.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param bucket:
|
:param bucket:
|
||||||
:param chat:
|
:param chat:
|
||||||
|
|
@ -254,10 +255,10 @@ class BaseStorage:
|
||||||
chat: typing.Union[str, int, None] = None,
|
chat: typing.Union[str, int, None] = None,
|
||||||
user: typing.Union[str, int, None] = None):
|
user: typing.Union[str, int, None] = None):
|
||||||
"""
|
"""
|
||||||
Reset data dor user in chat.
|
Reset bucket dor user in chat.
|
||||||
|
|
||||||
Chat or user is always required. If one of this is not presented,
|
Chat or user is always required. If one of them is not provided,
|
||||||
need set the missing value based on the presented
|
you have to set missing value based on the provided one.
|
||||||
|
|
||||||
:param chat:
|
:param chat:
|
||||||
:param user:
|
:param user:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue