From 44ccf010a19285cc06eed9061bf0aac266118088 Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 13 Dec 2022 14:45:10 +0100 Subject: [PATCH] Improved docstrings --- classes/holo_user.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/classes/holo_user.py b/classes/holo_user.py index 6b8a55b..96015a9 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -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: