From a6477541c0e5b64822544041c00c9bad9449b637 Mon Sep 17 00:00:00 2001 From: coder2020official Date: Sat, 19 Mar 2022 13:49:36 +0500 Subject: [PATCH] Documentation incorrect display is fixed now. --- telebot/__init__.py | 22 +++++++++++++--------- telebot/callback_data.py | 3 +++ telebot/types.py | 4 ++++ telebot/util.py | 4 +++- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 9d4fde3..2a1bce9 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1148,15 +1148,15 @@ class TeleBot: Telegram documentation: https://core.telegram.org/bots/api#sendaudio - :param chat_id:Unique identifier for the message recipient - :param audio:Audio file to send. + :param chat_id: Unique identifier for the message recipient + :param audio: Audio file to send. :param caption: - :param duration:Duration of the audio in seconds - :param performer:Performer - :param title:Track name - :param reply_to_message_id:If the message is a reply, ID of the original message + :param duration: Duration of the audio in seconds + :param performer: Performer + :param title: Track name + :param reply_to_message_id: If the message is a reply, ID of the original message :param reply_markup: - :param parse_mode + :param parse_mode: :param disable_notification: :param timeout: :param thumb: @@ -2936,7 +2936,8 @@ class TeleBot: def add_middleware_handler(self, handler, update_types=None): """ - Add middleware handler + Add middleware handler. + :param handler: :param update_types: :return: @@ -3146,6 +3147,7 @@ class TeleBot: """ Adds the edit message handler Note that you should use register_edited_message_handler to add edited_message_handler to the bot. + :param handler_dict: :return: """ @@ -3424,6 +3426,7 @@ class TeleBot: def register_chosen_inline_handler(self, callback, func, pass_bot=False, **kwargs): """ Registers chosen inline handler. + :param callback: function to be called :param func: :param pass_bot: Pass TeleBot to handler. @@ -3719,6 +3722,7 @@ class TeleBot: def register_chat_join_request_handler(self, callback, func=None, pass_bot=False, **kwargs): """ Registers chat join request handler. + :param callback: function to be called :param func: :param pass_bot: Pass TeleBot to handler. @@ -3748,7 +3752,7 @@ class TeleBot: """ Create custom filter. - custom_filter: Class with check(message) method. + :param custom_filter: Class with check(message) method. :param custom_filter: Custom filter class with key. """ self.custom_filters[custom_filter.key] = custom_filter diff --git a/telebot/callback_data.py b/telebot/callback_data.py index ecbe81e..17bf27f 100644 --- a/telebot/callback_data.py +++ b/telebot/callback_data.py @@ -10,6 +10,7 @@ class CallbackDataFilter: def check(self, query): """ Checks if query.data appropriates to specified config + :param query: telebot.types.CallbackQuery :return: bool """ @@ -50,6 +51,7 @@ class CallbackData: def new(self, *args, **kwargs) -> str: """ Generate callback data + :param args: positional parameters of CallbackData instance parts :param kwargs: named parameters :return: str @@ -87,6 +89,7 @@ class CallbackData: def parse(self, callback_data: str) -> typing.Dict[str, str]: """ Parse data from the callback data + :param callback_data: string, use to telebot.types.CallbackQuery to parse it from string to a dict :return: dict parsed from callback data """ diff --git a/telebot/types.py b/telebot/types.py index 081c0ed..0c6c3bc 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -69,6 +69,7 @@ class JsonDeserializable(object): """ Checks whether json_type is a dict or a string. If it is already a dict, it is returned as-is. If it is not, it is converted to a dict by means of json.loads(json_type) + :param json_type: input json or parsed dict :param dict_copy: if dict is passed and it is changed outside - should be True! :return: Dictionary parsed from json or original dict @@ -943,6 +944,7 @@ class ReplyKeyboardMarkup(JsonSerializable): when row_width is set to 1. When row_width is set to 2, the following is the result of this function: {keyboard: [["A", "B"], ["C"]]} See https://core.telegram.org/bots/api#replykeyboardmarkup + :param args: KeyboardButton to append to the keyboard :param row_width: width of row :return: self, to allow function chaining. @@ -974,6 +976,7 @@ class ReplyKeyboardMarkup(JsonSerializable): Adds a list of KeyboardButton to the keyboard. This function does not consider row_width. ReplyKeyboardMarkup#row("A")#row("B", "C")#to_json() outputs '{keyboard: [["A"], ["B", "C"]]}' See https://core.telegram.org/bots/api#replykeyboardmarkup + :param args: strings :return: self, to allow function chaining. """ @@ -2399,6 +2402,7 @@ class ShippingOption(JsonSerializable): def add_price(self, *args): """ Add LabeledPrice to ShippingOption + :param args: LabeledPrices """ for price in args: diff --git a/telebot/util.py b/telebot/util.py index 14ed360..79ed2b1 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -226,8 +226,9 @@ def pil_image_to_file(image, extension='JPEG', quality='web_low'): def is_command(text: str) -> bool: - """ + r""" Checks if `text` is a command. Telegram chat commands start with the '/' character. + :param text: Text to check. :return: True if `text` is a command, else False. """ @@ -452,6 +453,7 @@ def deprecated(warn: bool=True, alternative: Optional[Callable]=None): """ Use this decorator to mark functions as deprecated. When the function is used, an info (or warning if `warn` is True) is logged. + :param warn: If True a warning is logged else an info :param alternative: The new function to use instead """