Improved docstrings

This commit is contained in:
Profitroll 2022-12-14 14:57:39 +01:00
parent 3ffa6e32f9
commit f1990345ce
2 changed files with 27 additions and 10 deletions

View File

@ -104,14 +104,14 @@ class HoloUser():
### Args: ### Args:
* context (`Message`): Context (mostly the message where this method is called) * context (`Message`): Context (mostly the message where this method is called)
* origin (`Union[Message, None]`, optional): Origin message where to refer. None if called in a command. Defaults to None. * origin (`Union[Message, None]`, *optional*): Origin message where to refer. None if called in a command. Defaults to None.
* text (`Union[str, None]`, optional): Text if this is a simple text message. Defaults to None. * text (`Union[str, None]`, *optional*): Text if this is a simple text message. Defaults to None.
* caption (`Union[str, None]`, optional): Text if this is a media message. Defaults to None. * caption (`Union[str, None]`, *optional*): Text if this is a media message. Defaults to None.
* photo (`Union[str, Photo, None]`, optional): Photo as a photo object or file_id as a string. Defaults to None. * photo (`Union[str, Photo, None]`, *optional*): Photo as a photo object or file_id as a string. Defaults to None.
* video (`Union[str, Video, None]`, optional): Video as a video object or file_id as a string. Defaults to None. * video (`Union[str, Video, None]`, *optional*): Video as a video object or file_id as a string. Defaults to None.
* file (`Union[str, Document, None]`, optional): File as a document object or file_id as a string. Defaults to None. * 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. * 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. * 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_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_context (`bool`, *optional*): Whether context sender is an admin. Defaults to False.
""" """

View File

@ -13,6 +13,11 @@ with open(getcwd()+path.sep+"config.json", "r", encoding='utf8') as file:
# Check latest log size # Check latest log size
def checkSize(debug=False): def checkSize(debug=False):
"""Check size of latest.log file and rotate it if needed
### Args:
* debug (`bool`, *optional*): Whether this is a debug log. Defaults to `False`.
"""
global log_folder global log_folder
@ -35,7 +40,13 @@ def checkSize(debug=False):
pass pass
# Append string to log # Append string to log
def logAppend(message, debug=False): def logAppend(message: str, debug=False):
"""Write message to log file
### Args:
* message (`str`): Message to write
* debug (`bool`, *optional*): Whether this is a debug log. Defaults to `False`.
"""
global log_folder global log_folder
@ -52,7 +63,13 @@ def logAppend(message, debug=False):
log.close() log.close()
# Print to stdout and then to log # Print to stdout and then to log
def logWrite(message, debug=False): def logWrite(message: str, debug=False):
"""Write message to stdout and log file
### Args:
* message (`str`): Message to print and write
* debug (`bool`, *optional*): Whether this is a debug log. Defaults to `False`.
"""
# save to log file and rotation is to be done # save to log file and rotation is to be done
logAppend(f'{message}', debug=debug) logAppend(f'{message}', debug=debug)
print(f"{message}", flush=True) print(f"{message}", flush=True)