Improved docstrings

This commit is contained in:
Profitroll 2022-12-13 14:45:10 +01:00
parent c475667c40
commit 44ccf010a1
1 changed files with 16 additions and 3 deletions

View File

@ -22,8 +22,21 @@ class UserInvalidError(Exception):
super().__init__(f"Could not find HoloUser by using {type(self.user)} as an input type")
class HoloUser():
"""This object represents a user of HoloChecker bot.
It is primarily used to interact with a database in a more python-friendly way,
as well as provide better programming experience in case of adding new features, etc.
"""
def __init__(self, user: Union[List[User], User, ChatMember, int, str]) -> None:
def __init__(self, user: Union[User, List[User], ChatMember, int, str]) -> None:
"""A user of Holo bot. Used to simplify DB interaction.
### Args:
* user (`Union[User, List[User], ChatMember, int, str]`): Any possible way to identify the user. Pass `User` object, user's telegram ID, username or something...
### Raises:
* UserInvalidError: Provided to `HoloUser` object is not supported
* UserNotFoundError: `HoloUser` could not find user with such an ID in database
"""
# Determine input object class and extract id
if isinstance(user, list) and len(user) != 0:
@ -97,8 +110,8 @@ class HoloUser():
* file (`Union[str, Document, None]`, optional): File as a document object or file_id as a string. Defaults to None.
* animation (`Union[str, Animation, None]`, optional): Animation as an animation object or file_id as a string. Defaults to None.
* voice (`Union[str, Voice, None]`, optional): Voice as a voice object or file_id as a string. Defaults to None.
* adm_origin (`bool`, optional): Whether origin sender is an admin. Defaults to False.
* adm_context (`bool`, optional): Whether context sender is an admin. Defaults to False.
* adm_origin (`bool`, *optional*): Whether origin sender is an admin. Defaults to False.
* adm_context (`bool`, *optional*): Whether context sender is an admin. Defaults to False.
"""
if text is not None: