From 2effff82542a6fdc0e47b95fc56ae61494df8656 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi Date: Wed, 30 Dec 2020 15:59:50 +0100 Subject: [PATCH] Change Order of Class DocStrings (#2256) --- telegram/bot.py | 12 +- telegram/botcommand.py | 9 +- telegram/callbackquery.py | 34 ++-- telegram/chat.py | 56 +++--- telegram/chatlocation.py | 8 +- telegram/chatmember.py | 72 ++++---- telegram/chatpermissions.py | 40 ++-- telegram/choseninlineresult.py | 20 +- telegram/dice.py | 9 +- telegram/ext/basepersistence.py | 20 +- telegram/ext/callbackqueryhandler.py | 36 ++-- telegram/ext/choseninlineresulthandler.py | 24 +-- telegram/ext/commandhandler.py | 42 ++--- telegram/ext/conversationhandler.py | 58 +++--- telegram/ext/defaults.py | 42 ++--- telegram/ext/dictpersistence.py | 16 +- telegram/ext/dispatcher.py | 26 +-- telegram/ext/filters.py | 77 ++++---- telegram/ext/handler.py | 24 +-- telegram/ext/inlinequeryhandler.py | 36 ++-- telegram/ext/jobqueue.py | 14 +- telegram/ext/messagehandler.py | 40 ++-- telegram/ext/messagequeue.py | 16 +- telegram/ext/picklepersistence.py | 34 ++-- telegram/ext/pollanswerhandler.py | 24 +-- telegram/ext/pollhandler.py | 24 +-- telegram/ext/precheckoutqueryhandler.py | 24 +-- telegram/ext/regexhandler.py | 34 ++-- telegram/ext/shippingqueryhandler.py | 24 +-- telegram/ext/stringcommandhandler.py | 22 +-- telegram/ext/stringregexhandler.py | 26 +-- telegram/ext/typehandler.py | 20 +- telegram/ext/updater.py | 36 ++-- telegram/files/animation.py | 28 +-- telegram/files/audio.py | 32 ++-- telegram/files/chatphoto.py | 27 +-- telegram/files/contact.py | 14 +- telegram/files/document.py | 22 +-- telegram/files/file.py | 22 +-- telegram/files/inputfile.py | 10 +- telegram/files/inputmedia.py | 148 +++++++-------- telegram/files/location.py | 24 +-- telegram/files/photosize.py | 20 +- telegram/files/sticker.py | 33 ++-- telegram/files/venue.py | 18 +- telegram/files/video.py | 28 +-- telegram/files/videonote.py | 22 +-- telegram/files/voice.py | 20 +- telegram/forcereply.py | 10 +- telegram/games/game.py | 28 +-- telegram/games/gamehighscore.py | 4 +- telegram/inline/inlinekeyboardbutton.py | 34 ++-- telegram/inline/inlinekeyboardmarkup.py | 8 +- telegram/inline/inlinequery.py | 16 +- telegram/inline/inlinequeryresult.py | 8 +- telegram/inline/inlinequeryresultarticle.py | 32 ++-- telegram/inline/inlinequeryresultaudio.py | 38 ++-- .../inline/inlinequeryresultcachedaudio.py | 32 ++-- .../inline/inlinequeryresultcacheddocument.py | 38 ++-- telegram/inline/inlinequeryresultcachedgif.py | 36 ++-- .../inline/inlinequeryresultcachedmpeg4gif.py | 36 ++-- .../inline/inlinequeryresultcachedphoto.py | 38 ++-- .../inline/inlinequeryresultcachedsticker.py | 18 +- .../inline/inlinequeryresultcachedvideo.py | 38 ++-- .../inline/inlinequeryresultcachedvoice.py | 34 ++-- telegram/inline/inlinequeryresultcontact.py | 32 ++-- telegram/inline/inlinequeryresultdocument.py | 48 ++--- telegram/inline/inlinequeryresultgame.py | 14 +- telegram/inline/inlinequeryresultgif.py | 48 ++--- telegram/inline/inlinequeryresultlocation.py | 44 ++--- telegram/inline/inlinequeryresultmpeg4gif.py | 48 ++--- telegram/inline/inlinequeryresultphoto.py | 46 ++--- telegram/inline/inlinequeryresultvenue.py | 38 ++-- telegram/inline/inlinequeryresultvideo.py | 50 ++--- telegram/inline/inlinequeryresultvoice.py | 36 ++-- telegram/inline/inputcontactmessagecontent.py | 14 +- .../inline/inputlocationmessagecontent.py | 24 +-- telegram/inline/inputtextmessagecontent.py | 24 +-- telegram/inline/inputvenuemessagecontent.py | 20 +- telegram/keyboardbutton.py | 23 +-- telegram/loginurl.py | 23 +-- telegram/message.py | 172 +++++++++--------- telegram/messageentity.py | 16 +- telegram/passport/credentials.py | 18 +- telegram/passport/encryptedpassportelement.py | 73 ++++---- telegram/passport/passportdata.py | 20 +- telegram/passport/passportelementerrors.py | 136 +++++++------- telegram/passport/passportfile.py | 18 +- telegram/payment/invoice.py | 14 +- telegram/payment/labeledprice.py | 8 +- telegram/payment/orderinfo.py | 12 +- telegram/payment/precheckoutquery.py | 24 +-- telegram/payment/shippingaddress.py | 16 +- telegram/payment/shippingoption.py | 10 +- telegram/payment/shippingquery.py | 16 +- telegram/payment/successfulpayment.py | 20 +- telegram/poll.py | 4 +- telegram/proximityalerttriggered.py | 9 +- telegram/replykeyboardmarkup.py | 14 +- telegram/replykeyboardremove.py | 16 +- telegram/update.py | 38 ++-- telegram/user.py | 30 +-- telegram/userprofilephotos.py | 8 +- telegram/utils/helpers.py | 5 +- telegram/webhookinfo.py | 24 +-- 105 files changed, 1585 insertions(+), 1583 deletions(-) diff --git a/telegram/bot.py b/telegram/bot.py index cc49c4d66..f833bad18 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -144,6 +144,12 @@ def log( class Bot(TelegramObject): """This object represents a Telegram Bot. + Note: + Most bot methods have the argument ``api_kwargs`` which allows to pass arbitrary keywords + to the Telegram API. This can be used to access new features of the API before they were + incorporated into PTB. However, this is not guaranteed to work, i.e. it will fail for + passing files. + Args: token (:obj:`str`): Bot's unique authentication. base_url (:obj:`str`, optional): Telegram Bot API service URL. @@ -155,12 +161,6 @@ class Bot(TelegramObject): defaults (:class:`telegram.ext.Defaults`, optional): An object containing default values to be used if not set explicitly in the bot methods. - Note: - Most bot methods have the argument ``api_kwargs`` which allows to pass arbitrary keywords - to the Telegram API. This can be used to access new features of the API before they were - incorporated into PTB. However, this is not guaranteed to work, i.e. it will fail for - passing files. - """ def __new__(cls, *args: Any, **kwargs: Any) -> 'Bot': # pylint: disable=W0613 diff --git a/telegram/botcommand.py b/telegram/botcommand.py index 4e82b2dc0..678da9be9 100644 --- a/telegram/botcommand.py +++ b/telegram/botcommand.py @@ -30,14 +30,15 @@ class BotCommand(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`command` and :attr:`description` are equal. - Attributes: - command (:obj:`str`): Text of the command. - description (:obj:`str`): Description of the command. - Args: command (:obj:`str`): Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores. description (:obj:`str`): Description of the command, 3-256 characters. + + Attributes: + command (:obj:`str`): Text of the command. + description (:obj:`str`): Description of the command. + """ def __init__(self, command: str, description: str, **_kwargs: Any): diff --git a/telegram/callbackquery.py b/telegram/callbackquery.py index 1ade06e89..b41b299a2 100644 --- a/telegram/callbackquery.py +++ b/telegram/callbackquery.py @@ -48,19 +48,10 @@ class CallbackQuery(TelegramObject): Note: * In Python `from` is a reserved word, use `from_user` instead. * Exactly one of the fields :attr:`data` or :attr:`game_short_name` will be present. - - Attributes: - id (:obj:`str`): Unique identifier for this query. - from_user (:class:`telegram.User`): Sender. - chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which - the message with the callback button was sent. - message (:class:`telegram.Message`): Optional. Message with the callback button that - originated the query. - data (:obj:`str`): Optional. Data associated with the callback button. - inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in - inline mode, that originated the query. - game_short_name (:obj:`str`): Optional. Short name of a Game to be returned. - bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. + * After the user presses an inline button, Telegram clients will display a progress bar + until you call :attr:`answer`. It is, therefore, necessary to react + by calling :attr:`telegram.Bot.answer_callback_query` even if no notification to the user + is needed (e.g., without specifying any of the optional parameters). Args: id (:obj:`str`): Unique identifier for this query. @@ -78,11 +69,18 @@ class CallbackQuery(TelegramObject): the unique identifier for the game bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. - Note: - After the user presses an inline button, Telegram clients will display a progress bar - until you call :attr:`answer`. It is, therefore, necessary to react - by calling :attr:`telegram.Bot.answer_callback_query` even if no notification to the user - is needed (e.g., without specifying any of the optional parameters). + Attributes: + id (:obj:`str`): Unique identifier for this query. + from_user (:class:`telegram.User`): Sender. + chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which + the message with the callback button was sent. + message (:class:`telegram.Message`): Optional. Message with the callback button that + originated the query. + data (:obj:`str`): Optional. Data associated with the callback button. + inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in + inline mode, that originated the query. + game_short_name (:obj:`str`): Optional. Short name of a Game to be returned. + bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. """ diff --git a/telegram/chat.py b/telegram/chat.py index 0a35d8f06..2447a26a5 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -62,34 +62,6 @@ class Chat(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. - Attributes: - id (:obj:`int`): Unique identifier for this chat. - type (:obj:`str`): Type of chat. - title (:obj:`str`): Optional. Title, for supergroups, channels and group chats. - username (:obj:`str`): Optional. Username. - first_name (:obj:`str`): Optional. First name of the other party in a private chat. - last_name (:obj:`str`): Optional. Last name of the other party in a private chat. - photo (:class:`telegram.ChatPhoto`): Optional. Chat photo. - bio (:obj:`str`): Optional. Bio of the other party in a private chat. Returned only in - :meth:`telegram.Bot.get_chat`. - description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats. - invite_link (:obj:`str`): Optional. Chat invite link, for supergroups and channel chats. - pinned_message (:class:`telegram.Message`): Optional. The most recent pinned message - (by sending date). Returned only in :meth:`telegram.Bot.get_chat`. - permissions (:class:`telegram.ChatPermissions`): Optional. Default chat member permissions, - for groups and supergroups. Returned only in :meth:`telegram.Bot.get_chat`. - slow_mode_delay (:obj:`int`): Optional. For supergroups, the minimum allowed delay between - consecutive messages sent by each unprivileged user. Returned only in - :meth:`telegram.Bot.get_chat`. - sticker_set_name (:obj:`str`): Optional. For supergroups, name of Group sticker set. - can_set_sticker_set (:obj:`bool`): Optional. :obj:`True`, if the bot can change group the - sticker set. - linked_chat_id (:obj:`int`): Optional. Unique identifier for the linked chat, i.e. the - discussion group identifier for a channel and vice versa; for supergroups and channel - chats. Returned only in :meth:`telegram.Bot.get_chat`. - location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which - the supergroup is connected. Returned only in :meth:`telegram.Bot.get_chat`. - Args: id (:obj:`int`): Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. @@ -131,6 +103,34 @@ class Chat(TelegramObject): the supergroup is connected. Returned only in :meth:`telegram.Bot.get_chat`. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + id (:obj:`int`): Unique identifier for this chat. + type (:obj:`str`): Type of chat. + title (:obj:`str`): Optional. Title, for supergroups, channels and group chats. + username (:obj:`str`): Optional. Username. + first_name (:obj:`str`): Optional. First name of the other party in a private chat. + last_name (:obj:`str`): Optional. Last name of the other party in a private chat. + photo (:class:`telegram.ChatPhoto`): Optional. Chat photo. + bio (:obj:`str`): Optional. Bio of the other party in a private chat. Returned only in + :meth:`telegram.Bot.get_chat`. + description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats. + invite_link (:obj:`str`): Optional. Chat invite link, for supergroups and channel chats. + pinned_message (:class:`telegram.Message`): Optional. The most recent pinned message + (by sending date). Returned only in :meth:`telegram.Bot.get_chat`. + permissions (:class:`telegram.ChatPermissions`): Optional. Default chat member permissions, + for groups and supergroups. Returned only in :meth:`telegram.Bot.get_chat`. + slow_mode_delay (:obj:`int`): Optional. For supergroups, the minimum allowed delay between + consecutive messages sent by each unprivileged user. Returned only in + :meth:`telegram.Bot.get_chat`. + sticker_set_name (:obj:`str`): Optional. For supergroups, name of Group sticker set. + can_set_sticker_set (:obj:`bool`): Optional. :obj:`True`, if the bot can change group the + sticker set. + linked_chat_id (:obj:`int`): Optional. Unique identifier for the linked chat, i.e. the + discussion group identifier for a channel and vice versa; for supergroups and channel + chats. Returned only in :meth:`telegram.Bot.get_chat`. + location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which + the supergroup is connected. Returned only in :meth:`telegram.Bot.get_chat`. + """ PRIVATE: ClassVar[str] = constants.CHAT_PRIVATE diff --git a/telegram/chatlocation.py b/telegram/chatlocation.py index 3dbe0516d..c93583034 100644 --- a/telegram/chatlocation.py +++ b/telegram/chatlocation.py @@ -35,16 +35,16 @@ class ChatLocation(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` is equal. - Attributes: - location (:class:`telegram.Location`): The location to which the supergroup is connected. - address (:obj:`str`): Location address, as defined by the chat owner - Args: location (:class:`telegram.Location`): The location to which the supergroup is connected. Can't be a live location. address (:obj:`str`): Location address; 1-64 characters, as defined by the chat owner **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + location (:class:`telegram.Location`): The location to which the supergroup is connected. + address (:obj:`str`): Location address, as defined by the chat owner + """ def __init__( diff --git a/telegram/chatmember.py b/telegram/chatmember.py index 2ee64def6..6c797421d 100644 --- a/telegram/chatmember.py +++ b/telegram/chatmember.py @@ -34,42 +34,6 @@ class ChatMember(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`user` and :attr:`status` are equal. - Attributes: - user (:class:`telegram.User`): Information about the user. - status (:obj:`str`): The member's status in the chat. - custom_title (:obj:`str`): Optional. Custom title for owner and administrators. - is_anonymous (:obj:`bool`): Optional. :obj:`True`, if the user's presence in the chat is - hidden. - until_date (:class:`datetime.datetime`): Optional. Date when restrictions will be lifted - for this user. - can_be_edited (:obj:`bool`): Optional. If the bot is allowed to edit administrator - privileges of that user. - can_change_info (:obj:`bool`): Optional. If the user can change the chat title, photo and - other settings. - can_post_messages (:obj:`bool`): Optional. If the administrator can post in the channel. - can_edit_messages (:obj:`bool`): Optional. If the administrator can edit messages of other - users. - can_delete_messages (:obj:`bool`): Optional. If the administrator can delete messages of - other users. - can_invite_users (:obj:`bool`): Optional. If the user can invite new users to the chat. - can_restrict_members (:obj:`bool`): Optional. If the administrator can restrict, ban or - unban chat members. - can_pin_messages (:obj:`bool`): Optional. If the user can pin messages. - can_promote_members (:obj:`bool`): Optional. If the administrator can add new - administrators. - is_member (:obj:`bool`): Optional. Restricted only. :obj:`True`, if the user is a member of - the chat at the moment of the request. - can_send_messages (:obj:`bool`): Optional. If the user can send text messages, contacts, - locations and venues. - can_send_media_messages (:obj:`bool`): Optional. If the user can send media messages, - implies can_send_messages. - can_send_polls (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - send polls. - can_send_other_messages (:obj:`bool`): Optional. If the user can send animations, games, - stickers and use inline bots, implies can_send_media_messages. - can_add_web_page_previews (:obj:`bool`): Optional. If user may add web page previews to his - messages, implies can_send_media_messages - Args: user (:class:`telegram.User`): Information about the user. status (:obj:`str`): The member's status in the chat. Can be 'creator', 'administrator', @@ -113,6 +77,42 @@ class ChatMember(TelegramObject): can_add_web_page_previews (:obj:`bool`, optional): Restricted only. :obj:`True`, if user may add web page previews to his messages. + Attributes: + user (:class:`telegram.User`): Information about the user. + status (:obj:`str`): The member's status in the chat. + custom_title (:obj:`str`): Optional. Custom title for owner and administrators. + is_anonymous (:obj:`bool`): Optional. :obj:`True`, if the user's presence in the chat is + hidden. + until_date (:class:`datetime.datetime`): Optional. Date when restrictions will be lifted + for this user. + can_be_edited (:obj:`bool`): Optional. If the bot is allowed to edit administrator + privileges of that user. + can_change_info (:obj:`bool`): Optional. If the user can change the chat title, photo and + other settings. + can_post_messages (:obj:`bool`): Optional. If the administrator can post in the channel. + can_edit_messages (:obj:`bool`): Optional. If the administrator can edit messages of other + users. + can_delete_messages (:obj:`bool`): Optional. If the administrator can delete messages of + other users. + can_invite_users (:obj:`bool`): Optional. If the user can invite new users to the chat. + can_restrict_members (:obj:`bool`): Optional. If the administrator can restrict, ban or + unban chat members. + can_pin_messages (:obj:`bool`): Optional. If the user can pin messages. + can_promote_members (:obj:`bool`): Optional. If the administrator can add new + administrators. + is_member (:obj:`bool`): Optional. Restricted only. :obj:`True`, if the user is a member of + the chat at the moment of the request. + can_send_messages (:obj:`bool`): Optional. If the user can send text messages, contacts, + locations and venues. + can_send_media_messages (:obj:`bool`): Optional. If the user can send media messages, + implies can_send_messages. + can_send_polls (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to + send polls. + can_send_other_messages (:obj:`bool`): Optional. If the user can send animations, games, + stickers and use inline bots, implies can_send_media_messages. + can_add_web_page_previews (:obj:`bool`): Optional. If user may add web page previews to his + messages, implies can_send_media_messages + """ ADMINISTRATOR: ClassVar[str] = constants.CHATMEMBER_ADMINISTRATOR diff --git a/telegram/chatpermissions.py b/telegram/chatpermissions.py index d66b586f4..60085af07 100644 --- a/telegram/chatpermissions.py +++ b/telegram/chatpermissions.py @@ -36,26 +36,6 @@ class ChatPermissions(TelegramObject): permissions that are set, but also sets all the others to :obj:`False`. However, since not documented, this behaviour may change unbeknown to PTB. - Attributes: - can_send_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send text - messages, contacts, locations and venues. - can_send_media_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - send audios, documents, photos, videos, video notes and voice notes, implies - :attr:`can_send_messages`. - can_send_polls (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send polls, - implies :attr:`can_send_messages`. - can_send_other_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - send animations, games, stickers and use inline bots, implies - :attr:`can_send_media_messages`. - can_add_web_page_previews (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to - add web page previews to their messages, implies :attr:`can_send_media_messages`. - can_change_info (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to change the - chat title, photo and other settings. Ignored in public supergroups. - can_invite_users (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to invite - new users to the chat. - can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin - messages. Ignored in public supergroups. - Args: can_send_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to send text messages, contacts, locations and venues. @@ -76,6 +56,26 @@ class ChatPermissions(TelegramObject): can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to pin messages. Ignored in public supergroups. + Attributes: + can_send_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send text + messages, contacts, locations and venues. + can_send_media_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to + send audios, documents, photos, videos, video notes and voice notes, implies + :attr:`can_send_messages`. + can_send_polls (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to send polls, + implies :attr:`can_send_messages`. + can_send_other_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to + send animations, games, stickers and use inline bots, implies + :attr:`can_send_media_messages`. + can_add_web_page_previews (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to + add web page previews to their messages, implies :attr:`can_send_media_messages`. + can_change_info (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to change the + chat title, photo and other settings. Ignored in public supergroups. + can_invite_users (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to invite + new users to the chat. + can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin + messages. Ignored in public supergroups. + """ def __init__( diff --git a/telegram/choseninlineresult.py b/telegram/choseninlineresult.py index 9c5d7e5b8..db9651e4f 100644 --- a/telegram/choseninlineresult.py +++ b/telegram/choseninlineresult.py @@ -37,14 +37,9 @@ class ChosenInlineResult(TelegramObject): considered equal, if their :attr:`result_id` is equal. Note: - In Python `from` is a reserved word, use `from_user` instead. - - Attributes: - result_id (:obj:`str`): The unique identifier for the result that was chosen. - from_user (:class:`telegram.User`): The user that chose the result. - location (:class:`telegram.Location`): Optional. Sender location. - inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message. - query (:obj:`str`): The query that was used to obtain the result. + * In Python `from` is a reserved word, use `from_user` instead. + * It is necessary to enable inline feedback via `@Botfather `_ in + order to receive these objects in updates. Args: result_id (:obj:`str`): The unique identifier for the result that was chosen. @@ -57,9 +52,12 @@ class ChosenInlineResult(TelegramObject): query (:obj:`str`): The query that was used to obtain the result. **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - It is necessary to enable inline feedback via `@Botfather `_ in - order to receive these objects in updates. + Attributes: + result_id (:obj:`str`): The unique identifier for the result that was chosen. + from_user (:class:`telegram.User`): The user that chose the result. + location (:class:`telegram.Location`): Optional. Sender location. + inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message. + query (:obj:`str`): The query that was used to obtain the result. """ diff --git a/telegram/dice.py b/telegram/dice.py index 6e648b841..f681d4c9a 100644 --- a/telegram/dice.py +++ b/telegram/dice.py @@ -49,14 +49,15 @@ class Dice(TelegramObject): can be found at our `wiki `_. However, this behaviour is undocumented and might be changed by Telegram. - Attributes: - value (:obj:`int`): Value of the dice. - emoji (:obj:`str`): Emoji on which the dice throw animation is based. - Args: value (:obj:`int`): Value of the dice. 1-6 for dice and darts, 1-5 for basketball and football/soccer ball, 1-64 for slot machine. emoji (:obj:`str`): Emoji on which the dice throw animation is based. + + Attributes: + value (:obj:`int`): Value of the dice. + emoji (:obj:`str`): Emoji on which the dice throw animation is based. + """ def __init__(self, value: int, emoji: str, **_kwargs: Any): diff --git a/telegram/ext/basepersistence.py b/telegram/ext/basepersistence.py index 378110ed6..816b1ddae 100644 --- a/telegram/ext/basepersistence.py +++ b/telegram/ext/basepersistence.py @@ -33,7 +33,7 @@ class BasePersistence(ABC): All relevant methods must be overwritten. This includes: - * meth:`get_bot_data` + * :meth:`get_bot_data` * :meth:`update_bot_data` * :meth:`get_chat_data` * :meth:`update_chat_data` @@ -44,7 +44,7 @@ class BasePersistence(ABC): * :meth:`flush` If you don't actually need one of those methods, a simple ``pass`` is enough. For example, if - ``store_bot_data=False``, you don't need :meth:`get_bot_data` and :meth:`update_bot_data. + ``store_bot_data=False``, you don't need :meth:`get_bot_data` and :meth:`update_bot_data`. Warning: Persistence will try to replace :class:`telegram.Bot` instances by :attr:`REPLACED_BOT` and @@ -58,14 +58,6 @@ class BasePersistence(ABC): of the :meth:`update/get_*` methods, i.e. you don't need to worry about it while implementing a custom persistence subclass. - Attributes: - store_user_data (:obj:`bool`): Optional, Whether user_data should be saved by this - persistence class. - store_chat_data (:obj:`bool`): Optional. Whether chat_data should be saved by this - persistence class. - store_bot_data (:obj:`bool`): Optional. Whether bot_data should be saved by this - persistence class. - Args: store_user_data (:obj:`bool`, optional): Whether user_data should be saved by this persistence class. Default is :obj:`True`. @@ -73,6 +65,14 @@ class BasePersistence(ABC): persistence class. Default is :obj:`True` . store_bot_data (:obj:`bool`, optional): Whether bot_data should be saved by this persistence class. Default is :obj:`True` . + + Attributes: + store_user_data (:obj:`bool`): Optional, Whether user_data should be saved by this + persistence class. + store_chat_data (:obj:`bool`): Optional. Whether chat_data should be saved by this + persistence class. + store_bot_data (:obj:`bool`): Optional. Whether bot_data should be saved by this + persistence class. """ def __new__(cls, *args: Any, **kwargs: Any) -> 'BasePersistence': # pylint: disable=W0613 diff --git a/telegram/ext/callbackqueryhandler.py b/telegram/ext/callbackqueryhandler.py index c229de76a..f03650b52 100644 --- a/telegram/ext/callbackqueryhandler.py +++ b/telegram/ext/callbackqueryhandler.py @@ -48,24 +48,6 @@ class CallbackQueryHandler(Handler[Update]): Read the documentation of the ``re`` module for more information. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pattern (:obj:`str` | `Pattern`): Optional. Regex pattern to test - :attr:`telegram.CallbackQuery.data` against. - pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the - callback function. - pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -118,6 +100,24 @@ class CallbackQueryHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pattern (:obj:`str` | `Pattern`): Optional. Regex pattern to test + :attr:`telegram.CallbackQuery.data` against. + pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the + callback function. + pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/choseninlineresulthandler.py b/telegram/ext/choseninlineresulthandler.py index f65cb2e97..bd5c0b9ff 100644 --- a/telegram/ext/choseninlineresulthandler.py +++ b/telegram/ext/choseninlineresulthandler.py @@ -30,18 +30,6 @@ RT = TypeVar('RT') class ChosenInlineResultHandler(Handler[Update]): """Handler class to handle Telegram updates that contain a chosen inline result. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -83,6 +71,18 @@ class ChosenInlineResultHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def check_update(self, update: Any) -> Optional[Union[bool, object]]: diff --git a/telegram/ext/commandhandler.py b/telegram/ext/commandhandler.py index 41a3d4907..76ab7d7f2 100644 --- a/telegram/ext/commandhandler.py +++ b/telegram/ext/commandhandler.py @@ -49,27 +49,6 @@ class CommandHandler(Handler[Update]): Note: :class:`telegram.ext.CommandHandler` does *not* handle (edited) channel posts. - Attributes: - command (:class:`telegram.utils.types.SLT[str]`): - The command or list of commands this handler should listen for. - Limitations are the same as described here https://core.telegram.org/bots#commands - callback (:obj:`callable`): The callback function for this handler. - filters (:class:`telegram.ext.BaseFilter`): Optional. Only allow updates with these - Filters. - allow_edited (:obj:`bool`): Determines whether the handler should also accept - edited messages. - pass_args (:obj:`bool`): Determines whether the handler should be passed - ``args``. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a :obj:`dict` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -129,6 +108,27 @@ class CommandHandler(Handler[Update]): Raises: ValueError - when command is too long or has illegal chars. + + Attributes: + command (:class:`telegram.utils.types.SLT[str]`): + The command or list of commands this handler should listen for. + Limitations are the same as described here https://core.telegram.org/bots#commands + callback (:obj:`callable`): The callback function for this handler. + filters (:class:`telegram.ext.BaseFilter`): Optional. Only allow updates with these + Filters. + allow_edited (:obj:`bool`): Determines whether the handler should also accept + edited messages. + pass_args (:obj:`bool`): Determines whether the handler should be passed + ``args``. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. """ def __init__( diff --git a/telegram/ext/conversationhandler.py b/telegram/ext/conversationhandler.py index 8de9e58ec..8ce027876 100644 --- a/telegram/ext/conversationhandler.py +++ b/telegram/ext/conversationhandler.py @@ -101,35 +101,6 @@ class ConversationHandler(Handler[Update]): .. _`examples`: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples - Attributes: - entry_points (List[:class:`telegram.ext.Handler`]): A list of ``Handler`` objects that can - trigger the start of the conversation. - states (Dict[:obj:`object`, List[:class:`telegram.ext.Handler`]]): A :obj:`dict` that - defines the different states of conversation a user can be in and one or more - associated ``Handler`` objects that should be used in that state. - fallbacks (List[:class:`telegram.ext.Handler`]): A list of handlers that might be used if - the user is in a conversation, but every handler for their current state returned - :obj:`False` on :attr:`check_update`. - allow_reentry (:obj:`bool`): Determines if a user can restart a conversation with - an entry point. - per_chat (:obj:`bool`): If the conversationkey should contain the Chat's ID. - per_user (:obj:`bool`): If the conversationkey should contain the User's ID. - per_message (:obj:`bool`): If the conversationkey should contain the Message's - ID. - conversation_timeout (:obj:`float` | :obj:`datetime.timedelta`): Optional. When this - handler is inactive more than this timeout (in seconds), it will be automatically - ended. If this value is 0 (default), there will be no timeout. When it's triggered, the - last received update and the corresponding ``context`` will be handled by ALL the - handler's who's :attr:`check_update` method returns :obj:`True` that are in the state - :attr:`ConversationHandler.TIMEOUT`. - name (:obj:`str`): Optional. The name for this conversationhandler. Required for - persistence - persistent (:obj:`bool`): Optional. If the conversations dict for this handler should be - saved. Name is required and persistence has to be set in :class:`telegram.ext.Updater` - map_to_parent (Dict[:obj:`object`, :obj:`object`]): Optional. A :obj:`dict` that can be - used to instruct a nested conversationhandler to transition into a mapped state on - its parent conversationhandler in place of a specified nested state. - Args: entry_points (List[:class:`telegram.ext.Handler`]): A list of ``Handler`` objects that can trigger the start of the conversation. The first handler which :attr:`check_update` @@ -169,6 +140,35 @@ class ConversationHandler(Handler[Update]): Raises: ValueError + Attributes: + entry_points (List[:class:`telegram.ext.Handler`]): A list of ``Handler`` objects that can + trigger the start of the conversation. + states (Dict[:obj:`object`, List[:class:`telegram.ext.Handler`]]): A :obj:`dict` that + defines the different states of conversation a user can be in and one or more + associated ``Handler`` objects that should be used in that state. + fallbacks (List[:class:`telegram.ext.Handler`]): A list of handlers that might be used if + the user is in a conversation, but every handler for their current state returned + :obj:`False` on :attr:`check_update`. + allow_reentry (:obj:`bool`): Determines if a user can restart a conversation with + an entry point. + per_chat (:obj:`bool`): If the conversationkey should contain the Chat's ID. + per_user (:obj:`bool`): If the conversationkey should contain the User's ID. + per_message (:obj:`bool`): If the conversationkey should contain the Message's + ID. + conversation_timeout (:obj:`float` | :obj:`datetime.timedelta`): Optional. When this + handler is inactive more than this timeout (in seconds), it will be automatically + ended. If this value is 0 (default), there will be no timeout. When it's triggered, the + last received update and the corresponding ``context`` will be handled by ALL the + handler's who's :attr:`check_update` method returns :obj:`True` that are in the state + :attr:`ConversationHandler.TIMEOUT`. + name (:obj:`str`): Optional. The name for this conversationhandler. Required for + persistence + persistent (:obj:`bool`): Optional. If the conversations dict for this handler should be + saved. Name is required and persistence has to be set in :class:`telegram.ext.Updater` + map_to_parent (Dict[:obj:`object`, :obj:`object`]): Optional. A :obj:`dict` that can be + used to instruct a nested conversationhandler to transition into a mapped state on + its parent conversationhandler in place of a specified nested state. + """ END: ClassVar[int] = -1 diff --git a/telegram/ext/defaults.py b/telegram/ext/defaults.py index d39bc03e4..a4ab04a55 100644 --- a/telegram/ext/defaults.py +++ b/telegram/ext/defaults.py @@ -28,27 +28,6 @@ from telegram.utils.helpers import DEFAULT_NONE, DefaultValue class Defaults: """Convenience Class to gather all parameters with a (user defined) default value - Attributes: - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or URLs in your bot's message. - disable_notification (:obj:`bool`): Optional. Sends the message silently. Users will - receive a notification with no sound. - disable_web_page_preview (:obj:`bool`): Optional. Disables link previews for links in this - message. - allow_sending_without_reply (:obj:`bool`): Optional. Pass :obj:`True`, if the message - should be sent even if the specified replied-to message is not found. - timeout (:obj:`int` | :obj:`float`): Optional. If this value is specified, use it as the - read timeout from the server (instead of the one specified during creation of the - connection pool). - quote (:obj:`bool`): Optional. If set to :obj:`True`, the reply is sent as an actual reply - to the message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will - be ignored. Default: :obj:`True` in group chats and :obj:`False` in private chats. - tzinfo (:obj:`tzinfo`): A timezone to be used for all date(time) objects appearing - throughout PTB. - run_async (:obj:`bool`): Optional. Default setting for the ``run_async`` parameter of - handlers and error handlers registered through :meth:`Dispatcher.add_handler` and - :meth:`Dispatcher.add_error_handler`. - Parameters: parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or URLs in your bot's message. @@ -71,6 +50,27 @@ class Defaults: run_async (:obj:`bool`, optional): Default setting for the ``run_async`` parameter of handlers and error handlers registered through :meth:`Dispatcher.add_handler` and :meth:`Dispatcher.add_error_handler`. Defaults to :obj:`False`. + + Attributes: + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or URLs in your bot's message. + disable_notification (:obj:`bool`): Optional. Sends the message silently. Users will + receive a notification with no sound. + disable_web_page_preview (:obj:`bool`): Optional. Disables link previews for links in this + message. + allow_sending_without_reply (:obj:`bool`): Optional. Pass :obj:`True`, if the message + should be sent even if the specified replied-to message is not found. + timeout (:obj:`int` | :obj:`float`): Optional. If this value is specified, use it as the + read timeout from the server (instead of the one specified during creation of the + connection pool). + quote (:obj:`bool`): Optional. If set to :obj:`True`, the reply is sent as an actual reply + to the message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will + be ignored. Default: :obj:`True` in group chats and :obj:`False` in private chats. + tzinfo (:obj:`tzinfo`): A timezone to be used for all date(time) objects appearing + throughout PTB. + run_async (:obj:`bool`): Optional. Default setting for the ``run_async`` parameter of + handlers and error handlers registered through :meth:`Dispatcher.add_handler` and + :meth:`Dispatcher.add_error_handler`. """ def __init__( diff --git a/telegram/ext/dictpersistence.py b/telegram/ext/dictpersistence.py index 51ec84136..d2cf119f9 100644 --- a/telegram/ext/dictpersistence.py +++ b/telegram/ext/dictpersistence.py @@ -54,14 +54,6 @@ class DictPersistence(BasePersistence): :meth:`telegram.ext.BasePersistence.replace_bot` and :meth:`telegram.ext.BasePersistence.insert_bot`. - Attributes: - store_user_data (:obj:`bool`): Whether user_data should be saved by this - persistence class. - store_chat_data (:obj:`bool`): Whether chat_data should be saved by this - persistence class. - store_bot_data (:obj:`bool`): Whether bot_data should be saved by this - persistence class. - Args: store_user_data (:obj:`bool`, optional): Whether user_data should be saved by this persistence class. Default is :obj:`True`. @@ -77,6 +69,14 @@ class DictPersistence(BasePersistence): bot_data on creating this persistence. Default is ``""``. conversations_json (:obj:`str`, optional): Json string that will be used to reconstruct conversation on creating this persistence. Default is ``""``. + + Attributes: + store_user_data (:obj:`bool`): Whether user_data should be saved by this + persistence class. + store_chat_data (:obj:`bool`): Whether chat_data should be saved by this + persistence class. + store_bot_data (:obj:`bool`): Whether bot_data should be saved by this + persistence class. """ def __init__( diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index acee97c65..51597f063 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -106,19 +106,6 @@ class DispatcherHandlerStop(Exception): class Dispatcher: """This class dispatches all kinds of updates to its registered handlers. - Attributes: - bot (:class:`telegram.Bot`): The bot object that should be passed to the handlers. - update_queue (:obj:`Queue`): The synchronized queue that will contain the updates. - job_queue (:class:`telegram.ext.JobQueue`): Optional. The :class:`telegram.ext.JobQueue` - instance to pass onto handler callbacks. - workers (:obj:`int`, optional): Number of maximum concurrent worker threads for the - ``@run_async`` decorator and :meth:`run_async`. - user_data (:obj:`defaultdict`): A dictionary handlers can use to store data for the user. - chat_data (:obj:`defaultdict`): A dictionary handlers can use to store data for the chat. - bot_data (:obj:`dict`): A dictionary handlers can use to store data for the bot. - persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to - store data that should be persistent over restarts. - Args: bot (:class:`telegram.Bot`): The bot object that should be passed to the handlers. update_queue (:obj:`Queue`): The synchronized queue that will contain the updates. @@ -132,6 +119,19 @@ class Dispatcher: API (ignored if `dispatcher` argument is used). Defaults to :obj:`True`. **New users**: set this to :obj:`True`. + Attributes: + bot (:class:`telegram.Bot`): The bot object that should be passed to the handlers. + update_queue (:obj:`Queue`): The synchronized queue that will contain the updates. + job_queue (:class:`telegram.ext.JobQueue`): Optional. The :class:`telegram.ext.JobQueue` + instance to pass onto handler callbacks. + workers (:obj:`int`, optional): Number of maximum concurrent worker threads for the + ``@run_async`` decorator and :meth:`run_async`. + user_data (:obj:`defaultdict`): A dictionary handlers can use to store data for the user. + chat_data (:obj:`defaultdict`): A dictionary handlers can use to store data for the chat. + bot_data (:obj:`dict`): A dictionary handlers can use to store data for the bot. + persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to + store data that should be persistent over restarts. + """ __singleton_lock = Lock() diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index adb56a4b3..408d8ebd6 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -1409,13 +1409,6 @@ officedocument.wordprocessingml.document")``- that it is not causing race conditions, as this will complete replace the current set of allowed users. - Attributes: - user_ids(set(:obj:`int`), optional): Which user ID(s) to allow through. - usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow - through. - allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user - is specified in :attr:`user_ids` and :attr:`usernames`. - Args: user_id(:class:`telegram.utils.types.SLT[int]`, optional): Which user ID(s) to allow through. @@ -1427,6 +1420,13 @@ officedocument.wordprocessingml.document")``- Raises: RuntimeError: If user_id and username are both present. + Attributes: + user_ids(set(:obj:`int`), optional): Which user ID(s) to allow through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow + through. + allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user + is specified in :attr:`user_ids` and :attr:`usernames`. + """ def __init__( @@ -1507,13 +1507,6 @@ officedocument.wordprocessingml.document")``- that it is not causing race conditions, as this will complete replace the current set of allowed bots. - Attributes: - bot_ids(set(:obj:`int`), optional): Which bot ID(s) to allow through. - usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow - through. - allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no bot - is specified in :attr:`bot_ids` and :attr:`usernames`. - Args: bot_id(:class:`telegram.utils.types.SLT[int]`, optional): Which bot ID(s) to allow through. @@ -1524,6 +1517,14 @@ officedocument.wordprocessingml.document")``- Raises: RuntimeError: If bot_id and username are both present. + + Attributes: + bot_ids(set(:obj:`int`), optional): Which bot ID(s) to allow through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow + through. + allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no bot + is specified in :attr:`bot_ids` and :attr:`usernames`. + """ def __init__( @@ -1604,13 +1605,6 @@ officedocument.wordprocessingml.document")``- that it is not causing race conditions, as this will complete replace the current set of allowed chats. - Attributes: - chat_ids(set(:obj:`int`), optional): Which chat ID(s) to allow through. - usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow - through. - allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat - is specified in :attr:`chat_ids` and :attr:`usernames`. - Args: chat_id(:class:`telegram.utils.types.SLT[int]`, optional): Which chat ID(s) to allow through. @@ -1623,6 +1617,13 @@ officedocument.wordprocessingml.document")``- Raises: RuntimeError: If chat_id and username are both present. + Attributes: + chat_ids(set(:obj:`int`), optional): Which chat ID(s) to allow through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow + through. + allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat + is specified in :attr:`chat_ids` and :attr:`usernames`. + """ def get_chat_or_user(self, message: Message) -> Optional[Chat]: @@ -1694,6 +1695,19 @@ officedocument.wordprocessingml.document")``- that it is not causing race conditions, as this will complete replace the current set of allowed chats. + Args: + chat_id(:class:`telegram.utils.types.SLT[int]`, optional): + Which sender chat chat ID(s) to allow through. + username(:class:`telegram.utils.types.SLT[str]`, optional): + Which sender chat sername(s) to allow through. + Leading `'@'` s in usernames will be discarded. + allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender + chat is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to + :obj:`False` + + Raises: + RuntimeError: If chat_id and username are both present. + Attributes: chat_ids(set(:obj:`int`), optional): Which sender chat chat ID(s) to allow through. usernames(set(:obj:`str`), optional): Which sender chat username(s) (without leading @@ -1709,19 +1723,6 @@ officedocument.wordprocessingml.document")``- Examples: ``Filters.sender_chat.channel`` - Args: - chat_id(:class:`telegram.utils.types.SLT[int]`, optional): - Which sender chat chat ID(s) to allow through. - username(:class:`telegram.utils.types.SLT[str]`, optional): - Which sender chat sername(s) to allow through. - Leading `'@'` s in usernames will be discarded. - allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender - chat is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to - :obj:`False` - - Raises: - RuntimeError: If chat_id and username are both present. - """ def get_chat_or_user(self, message: Message) -> Optional[Chat]: @@ -1839,14 +1840,14 @@ officedocument.wordprocessingml.document")``- To allow only dice with value 5 `or` 6, use ``MessageHandler(Filters.dice([5, 6]), callback_method)``. - Args: - update (:class:`telegram.utils.types.SLT[int]`, optional): - Which values to allow. If not specified, will allow any dice message. - Note: Dice messages don't have text. If you want to filter either text or dice messages, use ``Filters.text | Filters.dice``. + Args: + update (:class:`telegram.utils.types.SLT[int]`, optional): + Which values to allow. If not specified, will allow any dice message. + Attributes: dice: Dice messages with the emoji 🎲. Passing a list of integers is supported just as for :attr:`Filters.dice`. diff --git a/telegram/ext/handler.py b/telegram/ext/handler.py index 123ba543e..300ef2505 100644 --- a/telegram/ext/handler.py +++ b/telegram/ext/handler.py @@ -35,18 +35,6 @@ UT = TypeVar('UT') class Handler(Generic[UT], ABC): """The base class for all update handlers. Create custom handlers by inheriting from it. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -88,6 +76,18 @@ class Handler(Generic[UT], ABC): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/inlinequeryhandler.py b/telegram/ext/inlinequeryhandler.py index 4e30ca991..508ca1be7 100644 --- a/telegram/ext/inlinequeryhandler.py +++ b/telegram/ext/inlinequeryhandler.py @@ -47,24 +47,6 @@ class InlineQueryHandler(Handler[Update]): Handler class to handle Telegram inline queries. Optionally based on a regex. Read the documentation of the ``re`` module for more information. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pattern (:obj:`str` | :obj:`Pattern`): Optional. Regex pattern to test - :attr:`telegram.InlineQuery.query` against. - pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the - callback function. - pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -117,6 +99,24 @@ class InlineQueryHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pattern (:obj:`str` | :obj:`Pattern`): Optional. Regex pattern to test + :attr:`telegram.InlineQuery.query` against. + pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the + callback function. + pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/jobqueue.py b/telegram/ext/jobqueue.py index c176eaf25..bcb66f93d 100644 --- a/telegram/ext/jobqueue.py +++ b/telegram/ext/jobqueue.py @@ -522,13 +522,6 @@ class Job: * If :attr:`job` isn't passed on initialization, it must be set manually afterwards for this :class:`telegram.ext.Job` to be useful. - Attributes: - callback (:obj:`callable`): The callback function that should be executed by the new job. - context (:obj:`object`): Optional. Additional data needed for the callback function. - name (:obj:`str`): Optional. The name of the new job. - job_queue (:class:`telegram.ext.JobQueue`): Optional. The ``JobQueue`` this job belongs to. - job (:class:`apscheduler.job.Job`): Optional. The APS Job this job is a wrapper for. - Args: callback (:obj:`callable`): The callback function that should be executed by the new job. Callback signature for context based API: @@ -543,6 +536,13 @@ class Job: job_queue (:class:`telegram.ext.JobQueue`, optional): The ``JobQueue`` this job belongs to. Only optional for backward compatibility with ``JobQueue.put()``. job (:class:`apscheduler.job.Job`, optional): The APS Job this job is a wrapper for. + + Attributes: + callback (:obj:`callable`): The callback function that should be executed by the new job. + context (:obj:`object`): Optional. Additional data needed for the callback function. + name (:obj:`str`): Optional. The name of the new job. + job_queue (:class:`telegram.ext.JobQueue`): Optional. The ``JobQueue`` this job belongs to. + job (:class:`apscheduler.job.Job`): Optional. The APS Job this job is a wrapper for. """ def __init__( diff --git a/telegram/ext/messagehandler.py b/telegram/ext/messagehandler.py index 10b05d0bf..9445d58d9 100644 --- a/telegram/ext/messagehandler.py +++ b/telegram/ext/messagehandler.py @@ -37,26 +37,6 @@ RT = TypeVar('RT') class MessageHandler(Handler[Update]): """Handler class to handle telegram messages. They might contain text, media or status updates. - Attributes: - filters (:obj:`Filter`): Only allow updates with these Filters. See - :mod:`telegram.ext.filters` for a full list of all available filters. - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - message_updates (:obj:`bool`): Should "normal" message updates be handled? - Default is :obj:`None`. - channel_post_updates (:obj:`bool`): Should channel posts updates be handled? - Default is :obj:`None`. - edited_updates (:obj:`bool`): Should "edited" message updates be handled? - Default is :obj:`None`. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -118,6 +98,26 @@ class MessageHandler(Handler[Update]): Raises: ValueError + Attributes: + filters (:obj:`Filter`): Only allow updates with these Filters. See + :mod:`telegram.ext.filters` for a full list of all available filters. + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + message_updates (:obj:`bool`): Should "normal" message updates be handled? + Default is :obj:`None`. + channel_post_updates (:obj:`bool`): Should channel posts updates be handled? + Default is :obj:`None`. + edited_updates (:obj:`bool`): Should "edited" message updates be handled? + Default is :obj:`None`. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/messagequeue.py b/telegram/ext/messagequeue.py index 5a785fa88..1e399ad3c 100644 --- a/telegram/ext/messagequeue.py +++ b/telegram/ext/messagequeue.py @@ -44,14 +44,6 @@ class DelayQueue(threading.Thread): Processes callbacks from queue with specified throughput limits. Creates a separate thread to process callbacks with delays. - Attributes: - burst_limit (:obj:`int`): Number of maximum callbacks to process per time-window. - time_limit (:obj:`int`): Defines width of time-window used when each processing limit is - calculated. - exc_route (:obj:`callable`): A callable, accepting 1 positional argument; used to route - exceptions from processor thread to main thread; - name (:obj:`str`): Thread's name. - Args: queue (:obj:`Queue`, optional): Used to pass callbacks to thread. Creates ``Queue`` implicitly if not provided. @@ -69,6 +61,14 @@ class DelayQueue(threading.Thread): name (:obj:`str`, optional): Thread's name. Defaults to ``'DelayQueue-N'``, where N is sequential number of object created. + Attributes: + burst_limit (:obj:`int`): Number of maximum callbacks to process per time-window. + time_limit (:obj:`int`): Defines width of time-window used when each processing limit is + calculated. + exc_route (:obj:`callable`): A callable, accepting 1 positional argument; used to route + exceptions from processor thread to main thread; + name (:obj:`str`): Thread's name. + """ _instcnt = 0 # instance counter diff --git a/telegram/ext/picklepersistence.py b/telegram/ext/picklepersistence.py index f71101a17..fa6704a82 100644 --- a/telegram/ext/picklepersistence.py +++ b/telegram/ext/picklepersistence.py @@ -38,23 +38,6 @@ class PicklePersistence(BasePersistence): :meth:`telegram.ext.BasePersistence.replace_bot` and :meth:`telegram.ext.BasePersistence.insert_bot`. - Attributes: - filename (:obj:`str`): The filename for storing the pickle files. When :attr:`single_file` - is :obj:`False` this will be used as a prefix. - store_user_data (:obj:`bool`): Optional. Whether user_data should be saved by this - persistence class. - store_chat_data (:obj:`bool`): Optional. Whether user_data should be saved by this - persistence class. - store_bot_data (:obj:`bool`): Optional. Whether bot_data should be saved by this - persistence class. - single_file (:obj:`bool`): Optional. When :obj:`False` will store 3 separate files of - `filename_user_data`, `filename_chat_data` and `filename_conversations`. Default is - :obj:`True`. - on_flush (:obj:`bool`, optional): When :obj:`True` will only save to file when - :meth:`flush` is called and keep data in memory until that happens. When - :obj:`False` will store data on any transaction *and* on call to :meth:`flush`. - Default is :obj:`False`. - Args: filename (:obj:`str`): The filename for storing the pickle files. When :attr:`single_file` is :obj:`False` this will be used as a prefix. @@ -71,6 +54,23 @@ class PicklePersistence(BasePersistence): :meth:`flush` is called and keep data in memory until that happens. When :obj:`False` will store data on any transaction *and* on call to :meth:`flush`. Default is :obj:`False`. + + Attributes: + filename (:obj:`str`): The filename for storing the pickle files. When :attr:`single_file` + is :obj:`False` this will be used as a prefix. + store_user_data (:obj:`bool`): Optional. Whether user_data should be saved by this + persistence class. + store_chat_data (:obj:`bool`): Optional. Whether user_data should be saved by this + persistence class. + store_bot_data (:obj:`bool`): Optional. Whether bot_data should be saved by this + persistence class. + single_file (:obj:`bool`): Optional. When :obj:`False` will store 3 separate files of + `filename_user_data`, `filename_chat_data` and `filename_conversations`. Default is + :obj:`True`. + on_flush (:obj:`bool`, optional): When :obj:`True` will only save to file when + :meth:`flush` is called and keep data in memory until that happens. When + :obj:`False` will store data on any transaction *and* on call to :meth:`flush`. + Default is :obj:`False`. """ def __init__( diff --git a/telegram/ext/pollanswerhandler.py b/telegram/ext/pollanswerhandler.py index 17fd00ff0..52ab434dd 100644 --- a/telegram/ext/pollanswerhandler.py +++ b/telegram/ext/pollanswerhandler.py @@ -27,18 +27,6 @@ from .handler import Handler class PollAnswerHandler(Handler[Update]): """Handler class to handle Telegram updates that contain a poll answer. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -80,6 +68,18 @@ class PollAnswerHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def check_update(self, update: Any) -> bool: diff --git a/telegram/ext/pollhandler.py b/telegram/ext/pollhandler.py index 02f71edae..6a61c73fd 100644 --- a/telegram/ext/pollhandler.py +++ b/telegram/ext/pollhandler.py @@ -27,18 +27,6 @@ from .handler import Handler class PollHandler(Handler[Update]): """Handler class to handle Telegram updates that contain a poll. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -80,6 +68,18 @@ class PollHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def check_update(self, update: Any) -> bool: diff --git a/telegram/ext/precheckoutqueryhandler.py b/telegram/ext/precheckoutqueryhandler.py index 332279d18..f9bdb7b24 100644 --- a/telegram/ext/precheckoutqueryhandler.py +++ b/telegram/ext/precheckoutqueryhandler.py @@ -27,18 +27,6 @@ from .handler import Handler class PreCheckoutQueryHandler(Handler[Update]): """Handler class to handle Telegram PreCheckout callback queries. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -80,6 +68,18 @@ class PreCheckoutQueryHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def check_update(self, update: Any) -> bool: diff --git a/telegram/ext/regexhandler.py b/telegram/ext/regexhandler.py index ab6432843..cea67fb6a 100644 --- a/telegram/ext/regexhandler.py +++ b/telegram/ext/regexhandler.py @@ -40,23 +40,6 @@ class RegexHandler(MessageHandler): module for more information. The ``re.match`` function is used to determine if an update should be handled by this handler. - Attributes: - pattern (:obj:`str` | :obj:`Pattern`): The regex pattern. - callback (:obj:`callable`): The callback function for this handler. - pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the - callback function. - pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to - the callback function. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: This handler is being deprecated. For the same use case use: ``MessageHandler(Filters.regex(r'pattern'), callback)`` @@ -106,6 +89,23 @@ class RegexHandler(MessageHandler): Raises: ValueError + Attributes: + pattern (:obj:`str` | :obj:`Pattern`): The regex pattern. + callback (:obj:`callable`): The callback function for this handler. + pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the + callback function. + pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to + the callback function. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/shippingqueryhandler.py b/telegram/ext/shippingqueryhandler.py index d5a5d3725..45a9852e1 100644 --- a/telegram/ext/shippingqueryhandler.py +++ b/telegram/ext/shippingqueryhandler.py @@ -26,18 +26,6 @@ from .handler import Handler class ShippingQueryHandler(Handler[Update]): """Handler class to handle Telegram shipping callback queries. - Attributes: - callback (:obj:`callable`): The callback function for this handler. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to - the callback function. - pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Note: :attr:`pass_user_data` and :attr:`pass_chat_data` determine whether a ``dict`` you can use to keep any data in will be sent to the :attr:`callback` function. Related to @@ -79,6 +67,18 @@ class ShippingQueryHandler(Handler[Update]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + callback (:obj:`callable`): The callback function for this handler. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + pass_user_data (:obj:`bool`): Determines whether ``user_data`` will be passed to + the callback function. + pass_chat_data (:obj:`bool`): Determines whether ``chat_data`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def check_update(self, update: Any) -> bool: diff --git a/telegram/ext/stringcommandhandler.py b/telegram/ext/stringcommandhandler.py index 068cbb7b2..ac779ced2 100644 --- a/telegram/ext/stringcommandhandler.py +++ b/telegram/ext/stringcommandhandler.py @@ -41,17 +41,6 @@ class StringCommandHandler(Handler[str]): When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info. - Attributes: - command (:obj:`str`): The command this handler should listen for. - callback (:obj:`callable`): The callback function for this handler. - pass_args (:obj:`bool`): Determines whether the handler should be passed - ``args``. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Args: command (:obj:`str`): The command this handler should listen for. callback (:obj:`callable`): The callback function for this handler. Will be called when @@ -80,6 +69,17 @@ class StringCommandHandler(Handler[str]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + command (:obj:`str`): The command this handler should listen for. + callback (:obj:`callable`): The callback function for this handler. + pass_args (:obj:`bool`): Determines whether the handler should be passed + ``args``. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/stringregexhandler.py b/telegram/ext/stringregexhandler.py index 6caac3d38..05ff3caf2 100644 --- a/telegram/ext/stringregexhandler.py +++ b/telegram/ext/stringregexhandler.py @@ -45,19 +45,6 @@ class StringRegexHandler(Handler[str]): When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info. - Attributes: - pattern (:obj:`str` | :obj:`Pattern`): The regex pattern. - callback (:obj:`callable`): The callback function for this handler. - pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the - callback function. - pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to - the callback function. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Args: pattern (:obj:`str` | :obj:`Pattern`): The regex pattern. callback (:obj:`callable`): The callback function for this handler. Will be called when @@ -89,6 +76,19 @@ class StringRegexHandler(Handler[str]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + pattern (:obj:`str` | :obj:`Pattern`): The regex pattern. + callback (:obj:`callable`): The callback function for this handler. + pass_groups (:obj:`bool`): Determines whether ``groups`` will be passed to the + callback function. + pass_groupdict (:obj:`bool`): Determines whether ``groupdict``. will be passed to + the callback function. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/typehandler.py b/telegram/ext/typehandler.py index 7d40a0b5b..6ea4f72fe 100644 --- a/telegram/ext/typehandler.py +++ b/telegram/ext/typehandler.py @@ -33,16 +33,6 @@ UT = TypeVar('UT') class TypeHandler(Handler[UT]): """Handler class to handle updates of custom types. - Attributes: - type (:obj:`type`): The ``type`` of updates this handler should process. - callback (:obj:`callable`): The callback function for this handler. - strict (:obj:`bool`): Use ``type`` instead of ``isinstance``. Default is :obj:`False`. - pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be - passed to the callback function. - pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to - the callback function. - run_async (:obj:`bool`): Determines whether the callback will run asynchronously. - Warning: When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info. @@ -73,6 +63,16 @@ class TypeHandler(Handler[UT]): run_async (:obj:`bool`): Determines whether the callback will run asynchronously. Defaults to :obj:`False`. + Attributes: + type (:obj:`type`): The ``type`` of updates this handler should process. + callback (:obj:`callable`): The callback function for this handler. + strict (:obj:`bool`): Use ``type`` instead of ``isinstance``. Default is :obj:`False`. + pass_update_queue (:obj:`bool`): Determines whether ``update_queue`` will be + passed to the callback function. + pass_job_queue (:obj:`bool`): Determines whether ``job_queue`` will be passed to + the callback function. + run_async (:obj:`bool`): Determines whether the callback will run asynchronously. + """ def __init__( diff --git a/telegram/ext/updater.py b/telegram/ext/updater.py index 4f2588850..54224764b 100644 --- a/telegram/ext/updater.py +++ b/telegram/ext/updater.py @@ -50,19 +50,10 @@ class Updater: production, use a webhook to receive updates. This is achieved using the WebhookServer and WebhookHandler classes. - - Attributes: - bot (:class:`telegram.Bot`): The bot used with this Updater. - user_sig_handler (:obj:`function`): Optional. Function to be called when a signal is - received. - update_queue (:obj:`Queue`): Queue for the updates. - job_queue (:class:`telegram.ext.JobQueue`): Jobqueue for the updater. - dispatcher (:class:`telegram.ext.Dispatcher`): Dispatcher that handles the updates and - dispatches them to the handlers. - running (:obj:`bool`): Indicates if the updater is running. - persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to - store data that should be persistent over restarts. - use_context (:obj:`bool`): Optional. :obj:`True` if using context based callbacks. + Note: + * You must supply either a :attr:`bot` or a :attr:`token` argument. + * If you supply a :attr:`bot`, you will need to pass :attr:`defaults` to *both* the bot and + the :class:`telegram.ext.Updater`. Args: token (:obj:`str`, optional): The bot's token given by the @BotFather. @@ -95,14 +86,23 @@ class Updater: defaults (:class:`telegram.ext.Defaults`, optional): An object containing default values to be used if not set explicitly in the bot methods. - Note: - * You must supply either a :attr:`bot` or a :attr:`token` argument. - * If you supply a :attr:`bot`, you will need to pass :attr:`defaults` to *both* the bot and - the :class:`telegram.ext.Updater`. - Raises: ValueError: If both :attr:`token` and :attr:`bot` are passed or none of them. + + Attributes: + bot (:class:`telegram.Bot`): The bot used with this Updater. + user_sig_handler (:obj:`function`): Optional. Function to be called when a signal is + received. + update_queue (:obj:`Queue`): Queue for the updates. + job_queue (:class:`telegram.ext.JobQueue`): Jobqueue for the updater. + dispatcher (:class:`telegram.ext.Dispatcher`): Dispatcher that handles the updates and + dispatches them to the handlers. + running (:obj:`bool`): Indicates if the updater is running. + persistence (:class:`telegram.ext.BasePersistence`): Optional. The persistence class to + store data that should be persistent over restarts. + use_context (:obj:`bool`): Optional. :obj:`True` if using context based callbacks. + """ _request = None diff --git a/telegram/files/animation.py b/telegram/files/animation.py index 830cfa3e2..f9ed51e31 100644 --- a/telegram/files/animation.py +++ b/telegram/files/animation.py @@ -32,20 +32,6 @@ class Animation(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): File identifier. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Video width as defined by sender. - height (:obj:`int`): Video height as defined by sender. - duration (:obj:`int`): Duration of the video in seconds as defined by sender. - thumb (:class:`telegram.PhotoSize`): Optional. Animation thumbnail as defined by sender. - file_name (:obj:`str`): Optional. Original animation filename as defined by sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -62,6 +48,20 @@ class Animation(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): File identifier. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + width (:obj:`int`): Video width as defined by sender. + height (:obj:`int`): Video height as defined by sender. + duration (:obj:`int`): Duration of the video in seconds as defined by sender. + thumb (:class:`telegram.PhotoSize`): Optional. Animation thumbnail as defined by sender. + file_name (:obj:`str`): Optional. Original animation filename as defined by sender. + mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/files/audio.py b/telegram/files/audio.py index 29f2aa9b9..cbf5f63c8 100644 --- a/telegram/files/audio.py +++ b/telegram/files/audio.py @@ -33,22 +33,6 @@ class Audio(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - duration (:obj:`int`): Duration of the audio in seconds. - performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio - tags. - title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. - file_name (:obj:`str`): Optional. Original filename as defined by sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. - file_size (:obj:`int`): Optional. File size. - thumb (:class:`telegram.PhotoSize`): Optional. Thumbnail of the album cover to - which the music file belongs. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -66,6 +50,22 @@ class Audio(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + duration (:obj:`int`): Duration of the audio in seconds. + performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio + tags. + title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. + file_name (:obj:`str`): Optional. Original filename as defined by sender. + mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. + file_size (:obj:`int`): Optional. File size. + thumb (:class:`telegram.PhotoSize`): Optional. Thumbnail of the album cover to + which the music file belongs. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/files/chatphoto.py b/telegram/files/chatphoto.py index a2a3dd823..a7246013a 100644 --- a/telegram/files/chatphoto.py +++ b/telegram/files/chatphoto.py @@ -33,19 +33,6 @@ class ChatPhoto(TelegramObject): considered equal, if their :attr:`small_file_unique_id` and :attr:`big_file_unique_id` are equal. - Attributes: - small_file_id (:obj:`str`): File identifier of small (160x160) chat photo. - This file_id can be used only for photo download and only for as long - as the photo is not changed. - small_file_unique_id (:obj:`str`): Unique file identifier of small (160x160) chat photo, - which is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - big_file_id (:obj:`str`): File identifier of big (640x640) chat photo. - This file_id can be used only for photo download and only for as long as - the photo is not changed. - big_file_unique_id (:obj:`str`): Unique file identifier of big (640x640) chat photo, - which is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. Args: small_file_id (:obj:`str`): Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long @@ -61,6 +48,20 @@ class ChatPhoto(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + small_file_id (:obj:`str`): File identifier of small (160x160) chat photo. + This file_id can be used only for photo download and only for as long + as the photo is not changed. + small_file_unique_id (:obj:`str`): Unique file identifier of small (160x160) chat photo, + which is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + big_file_id (:obj:`str`): File identifier of big (640x640) chat photo. + This file_id can be used only for photo download and only for as long as + the photo is not changed. + big_file_unique_id (:obj:`str`): Unique file identifier of big (640x640) chat photo, + which is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + """ def __init__( diff --git a/telegram/files/contact.py b/telegram/files/contact.py index 74a138678..d3e9f1aa1 100644 --- a/telegram/files/contact.py +++ b/telegram/files/contact.py @@ -29,13 +29,6 @@ class Contact(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`phone_number` is equal. - Attributes: - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - user_id (:obj:`int`): Optional. Contact's user identifier in Telegram. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard. - Args: phone_number (:obj:`str`): Contact's phone number. first_name (:obj:`str`): Contact's first name. @@ -44,6 +37,13 @@ class Contact(TelegramObject): vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + phone_number (:obj:`str`): Contact's phone number. + first_name (:obj:`str`): Contact's first name. + last_name (:obj:`str`): Optional. Contact's last name. + user_id (:obj:`int`): Optional. Contact's user identifier in Telegram. + vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard. + """ def __init__( diff --git a/telegram/files/document.py b/telegram/files/document.py index 31f74b2b7..763c0f865 100644 --- a/telegram/files/document.py +++ b/telegram/files/document.py @@ -34,17 +34,6 @@ class Document(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): File identifier. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - thumb (:class:`telegram.PhotoSize`): Optional. Document thumbnail. - file_name (:obj:`str`): Original filename. - mime_type (:obj:`str`): Optional. MIME type of the file. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -57,6 +46,17 @@ class Document(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): File identifier. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + thumb (:class:`telegram.PhotoSize`): Optional. Document thumbnail. + file_name (:obj:`str`): Original filename. + mime_type (:obj:`str`): Optional. MIME type of the file. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ _id_keys = ('file_id',) diff --git a/telegram/files/file.py b/telegram/files/file.py index b1a347501..b1505db14 100644 --- a/telegram/files/file.py +++ b/telegram/files/file.py @@ -42,15 +42,9 @@ class File(TelegramObject): considered equal, if their :attr:`file_unique_id` is equal. Note: - Maximum file size to download is 20 MB. - - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - file_size (:obj:`str`): Optional. File size. - file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file. + * Maximum file size to download is 20 MB. + * If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`, + then it will automatically be decrypted as it downloads when you call :attr:`download()`. Args: file_id (:obj:`str`): Identifier for this file, which can be used to download @@ -63,9 +57,13 @@ class File(TelegramObject): bot (:obj:`telegram.Bot`, optional): Bot to use with shortcut method. **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`, - then it will automatically be decrypted as it downloads when you call :attr:`download()`. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + file_size (:obj:`str`): Optional. File size. + file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file. """ diff --git a/telegram/files/inputfile.py b/telegram/files/inputfile.py index 743501304..6bece4e5d 100644 --- a/telegram/files/inputfile.py +++ b/telegram/files/inputfile.py @@ -33,11 +33,6 @@ logger = logging.getLogger(__name__) class InputFile: """This object represents a Telegram InputFile. - Attributes: - input_file_content (:obj:`bytes`): The binary content of the file to send. - filename (:obj:`str`): Optional. Filename for the file to be sent. - attach (:obj:`str`): Optional. Attach id for sending multiple files. - Args: obj (:obj:`File handler` | :obj:`bytes`): An open file descriptor or the files content as bytes. @@ -48,6 +43,11 @@ class InputFile: Raises: TelegramError + Attributes: + input_file_content (:obj:`bytes`): The binary content of the file to send. + filename (:obj:`str`): Optional. Filename for the file to be sent. + attach (:obj:`str`): Optional. Attach id for sending multiple files. + """ def __init__(self, obj: Union[IO, bytes], filename: str = None, attach: bool = None): diff --git a/telegram/files/inputmedia.py b/telegram/files/inputmedia.py index 854317ae1..b693e5bbf 100644 --- a/telegram/files/inputmedia.py +++ b/telegram/files/inputmedia.py @@ -59,18 +59,10 @@ class InputMedia(TelegramObject): class InputMediaAnimation(InputMedia): """Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. - Attributes: - type (:obj:`str`): ``animation``. - media (:obj:`str` | :class:`telegram.InputFile`): Animation to send. - caption (:obj:`str`): Optional. Caption of the document to be sent. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption. - thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. - width (:obj:`int`): Optional. Animation width. - height (:obj:`int`): Optional. Animation height. - duration (:obj:`int`): Optional. Animation duration. - + Note: + When using a :class:`telegram.Animation` for the :attr:`media` attribute. It will take the + width, height and duration from that video, unless otherwise specified with the optional + arguments. Args: media (:obj:`str` | `filelike object` | :obj:`bytes` | :class:`pathlib.Path` | \ @@ -106,10 +98,18 @@ class InputMediaAnimation(InputMedia): height (:obj:`int`, optional): Animation height. duration (:obj:`int`, optional): Animation duration. - Note: - When using a :class:`telegram.Animation` for the :attr:`media` attribute. It will take the - width, height and duration from that video, unless otherwise specified with the optional - arguments. + Attributes: + type (:obj:`str`): ``animation``. + media (:obj:`str` | :class:`telegram.InputFile`): Animation to send. + caption (:obj:`str`): Optional. Caption of the document to be sent. + parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption. + thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + width (:obj:`int`): Optional. Animation width. + height (:obj:`int`): Optional. Animation height. + duration (:obj:`int`): Optional. Animation duration. + """ def __init__( @@ -152,14 +152,6 @@ class InputMediaAnimation(InputMedia): class InputMediaPhoto(InputMedia): """Represents a photo to be sent. - Attributes: - type (:obj:`str`): ``photo``. - media (:obj:`str` | :class:`telegram.InputFile`): Photo to send. - caption (:obj:`str`): Optional. Caption of the document to be sent. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption. - Args: media (:obj:`str` | `filelike object` | :obj:`bytes` | :class:`pathlib.Path` | \ :class:`telegram.PhotoSize`): File to send. Pass a @@ -181,6 +173,15 @@ class InputMediaPhoto(InputMedia): in :class:`telegram.ParseMode` for the available modes. caption_entities (List[:class:`telegram.MessageEntity`], optional): List of special entities that appear in the caption, which can be specified instead of parse_mode. + + Attributes: + type (:obj:`str`): ``photo``. + media (:obj:`str` | :class:`telegram.InputFile`): Photo to send. + caption (:obj:`str`): Optional. Caption of the document to be sent. + parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption. + """ def __init__( @@ -203,19 +204,13 @@ class InputMediaPhoto(InputMedia): class InputMediaVideo(InputMedia): """Represents a video to be sent. - Attributes: - type (:obj:`str`): ``video``. - media (:obj:`str` | :class:`telegram.InputFile`): Video file to send. - caption (:obj:`str`): Optional. Caption of the document to be sent. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption. - width (:obj:`int`): Optional. Video width. - height (:obj:`int`): Optional. Video height. - duration (:obj:`int`): Optional. Video duration. - supports_streaming (:obj:`bool`): Optional. Pass :obj:`True`, if the uploaded video is - suitable for streaming. - thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + Note: + * When using a :class:`telegram.Video` for the :attr:`media` attribute. It will take the + width, height and duration from that video, unless otherwise specified with the optional + arguments. + * ``thumb`` will be ignored for small video files, for which Telegram can easily + generate thumb nails. However, this behaviour is undocumented and might be changed + by Telegram. Args: media (:obj:`str` | `filelike object` | :obj:`bytes` | :class:`pathlib.Path` | \ @@ -253,13 +248,20 @@ class InputMediaVideo(InputMedia): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - Note: - * When using a :class:`telegram.Video` for the :attr:`media` attribute. It will take the - width, height and duration from that video, unless otherwise specified with the optional - arguments. - * ``thumb`` will be ignored for small video files, for which Telegram can easily - generate thumb nails. However, this behaviour is undocumented and might be changed - by Telegram. + Attributes: + type (:obj:`str`): ``video``. + media (:obj:`str` | :class:`telegram.InputFile`): Video file to send. + caption (:obj:`str`): Optional. Caption of the document to be sent. + parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption. + width (:obj:`int`): Optional. Video width. + height (:obj:`int`): Optional. Video height. + duration (:obj:`int`): Optional. Video duration. + supports_streaming (:obj:`bool`): Optional. Pass :obj:`True`, if the uploaded video is + suitable for streaming. + thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + """ def __init__( @@ -305,18 +307,10 @@ class InputMediaVideo(InputMedia): class InputMediaAudio(InputMedia): """Represents an audio file to be treated as music to be sent. - Attributes: - type (:obj:`str`): ``audio``. - media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send. - caption (:obj:`str`): Optional. Caption of the document to be sent. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption. - duration (:obj:`int`): Duration of the audio in seconds. - performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio - tags. - title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. - thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + Note: + When using a :class:`telegram.Audio` for the :attr:`media` attribute. It will take the + duration, performer and title from that video, unless otherwise specified with the + optional arguments. Args: media (:obj:`str` | `filelike object` | :obj:`bytes` | :class:`pathlib.Path` | \ @@ -354,10 +348,19 @@ class InputMediaAudio(InputMedia): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - Note: - When using a :class:`telegram.Audio` for the :attr:`media` attribute. It will take the - duration, performer and title from that video, unless otherwise specified with the - optional arguments. + Attributes: + type (:obj:`str`): ``audio``. + media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send. + caption (:obj:`str`): Optional. Caption of the document to be sent. + parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption. + duration (:obj:`int`): Duration of the audio in seconds. + performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio + tags. + title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. + thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + """ def __init__( @@ -400,18 +403,6 @@ class InputMediaAudio(InputMedia): class InputMediaDocument(InputMedia): """Represents a general file to be sent. - Attributes: - type (:obj:`str`): ``document``. - media (:obj:`str` | :class:`telegram.InputFile`): File to send. - caption (:obj:`str`): Optional. Caption of the document to be sent. - parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption. - thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. - disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side - content type detection for files uploaded using multipart/form-data. Always true, if - the document is sent as part of an album. - Args: media (:obj:`str` | `filelike object` | :obj:`bytes` | :class:`pathlib.Path` | \ :class:`telegram.Document`): File to send. Pass a @@ -445,6 +436,19 @@ class InputMediaDocument(InputMedia): disable_content_type_detection (:obj:`bool`, optional): Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always true, if the document is sent as part of an album. + + Attributes: + type (:obj:`str`): ``document``. + media (:obj:`str` | :class:`telegram.InputFile`): File to send. + caption (:obj:`str`): Optional. Caption of the document to be sent. + parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption. + thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send. + disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side + content type detection for files uploaded using multipart/form-data. Always true, if + the document is sent as part of an album. + """ def __init__( diff --git a/telegram/files/location.py b/telegram/files/location.py index d8c29387c..9622cce3c 100644 --- a/telegram/files/location.py +++ b/telegram/files/location.py @@ -29,18 +29,6 @@ class Location(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`longitute` and :attr:`latitude` are equal. - Attributes: - longitude (:obj:`float`): Longitude as defined by sender. - latitude (:obj:`float`): Latitude as defined by sender. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters. - live_period (:obj:`int`): Optional. Time relative to the message sending date, during which - the location can be updated, in seconds. For active live locations only. - heading (:obj:`int`): Optional. The direction in which user is moving, in degrees. - For active live locations only. - proximity_alert_radius (:obj:`int`): Optional. Maximum distance for proximity alerts about - approaching another chat member, in meters. For sent live locations only. - Args: longitude (:obj:`float`): Longitude as defined by sender. latitude (:obj:`float`): Latitude as defined by sender. @@ -54,6 +42,18 @@ class Location(TelegramObject): approaching another chat member, in meters. For sent live locations only. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + longitude (:obj:`float`): Longitude as defined by sender. + latitude (:obj:`float`): Latitude as defined by sender. + horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, + measured in meters. + live_period (:obj:`int`): Optional. Time relative to the message sending date, during which + the location can be updated, in seconds. For active live locations only. + heading (:obj:`int`): Optional. The direction in which user is moving, in degrees. + For active live locations only. + proximity_alert_radius (:obj:`int`): Optional. Maximum distance for proximity alerts about + approaching another chat member, in meters. For sent live locations only. + """ def __init__( diff --git a/telegram/files/photosize.py b/telegram/files/photosize.py index d7e681ae3..51eed6ca6 100644 --- a/telegram/files/photosize.py +++ b/telegram/files/photosize.py @@ -33,16 +33,6 @@ class PhotoSize(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Photo width. - height (:obj:`int`): Photo height. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -55,6 +45,16 @@ class PhotoSize(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + width (:obj:`int`): Photo width. + height (:obj:`int`): Photo height. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/files/sticker.py b/telegram/files/sticker.py index 3d74ab6e2..6ebee3fbd 100644 --- a/telegram/files/sticker.py +++ b/telegram/files/sticker.py @@ -33,23 +33,6 @@ class Sticker(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Sticker width. - height (:obj:`int`): Sticker height. - is_animated (:obj:`bool`): :obj:`True`, if the sticker is animated. - thumb (:class:`telegram.PhotoSize`): Optional. Sticker thumbnail in the .webp or .jpg - format. - emoji (:obj:`str`): Optional. Emoji associated with the sticker. - set_name (:obj:`str`): Optional. Name of the sticker set to which the sticker belongs. - mask_position (:class:`telegram.MaskPosition`): Optional. For mask stickers, the position - where the mask should be placed. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -70,6 +53,22 @@ class Sticker(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + width (:obj:`int`): Sticker width. + height (:obj:`int`): Sticker height. + is_animated (:obj:`bool`): :obj:`True`, if the sticker is animated. + thumb (:class:`telegram.PhotoSize`): Optional. Sticker thumbnail in the .webp or .jpg + format. + emoji (:obj:`str`): Optional. Emoji associated with the sticker. + set_name (:obj:`str`): Optional. Name of the sticker set to which the sticker belongs. + mask_position (:class:`telegram.MaskPosition`): Optional. For mask stickers, the position + where the mask should be placed. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. """ diff --git a/telegram/files/venue.py b/telegram/files/venue.py index fa27950cb..10f256220 100644 --- a/telegram/files/venue.py +++ b/telegram/files/venue.py @@ -37,15 +37,6 @@ class Venue(TelegramObject): Foursquare details and Google Pace details are mutually exclusive. However, this behaviour is undocumented and might be changed by Telegram. - Attributes: - location (:class:`telegram.Location`): Venue location. - title (:obj:`str`): Name of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue. - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. - Args: location (:class:`telegram.Location`): Venue location. title (:obj:`str`): Name of the venue. @@ -58,6 +49,15 @@ class Venue(TelegramObject): `supported types `_.) **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + location (:class:`telegram.Location`): Venue location. + title (:obj:`str`): Name of the venue. + address (:obj:`str`): Address of the venue. + foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue. + foursquare_type (:obj:`str`): Optional. Foursquare type of the venue. + google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. + google_place_type (:obj:`str`): Optional. Google Places type of the venue. + """ def __init__( diff --git a/telegram/files/video.py b/telegram/files/video.py index da8bb39c5..6f8eef4b1 100644 --- a/telegram/files/video.py +++ b/telegram/files/video.py @@ -33,20 +33,6 @@ class Video(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - width (:obj:`int`): Video width as defined by sender. - height (:obj:`int`): Video height as defined by sender. - duration (:obj:`int`): Duration of the video in seconds as defined by sender. - thumb (:class:`telegram.PhotoSize`): Optional. Video thumbnail. - file_name (:obj:`str`): Optional. Original filename as defined by sender. - mime_type (:obj:`str`): Optional. Mime type of a file as defined by sender. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -63,6 +49,20 @@ class Video(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + width (:obj:`int`): Video width as defined by sender. + height (:obj:`int`): Video height as defined by sender. + duration (:obj:`int`): Duration of the video in seconds as defined by sender. + thumb (:class:`telegram.PhotoSize`): Optional. Video thumbnail. + file_name (:obj:`str`): Optional. Original filename as defined by sender. + mime_type (:obj:`str`): Optional. Mime type of a file as defined by sender. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/files/videonote.py b/telegram/files/videonote.py index 0293e2b7f..ba7b47a31 100644 --- a/telegram/files/videonote.py +++ b/telegram/files/videonote.py @@ -33,17 +33,6 @@ class VideoNote(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - length (:obj:`int`): Video width and height as defined by sender. - duration (:obj:`int`): Duration of the video in seconds as defined by sender. - thumb (:class:`telegram.PhotoSize`): Optional. Video thumbnail. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -58,6 +47,17 @@ class VideoNote(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + length (:obj:`int`): Video width and height as defined by sender. + duration (:obj:`int`): Duration of the video in seconds as defined by sender. + thumb (:class:`telegram.PhotoSize`): Optional. Video thumbnail. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/files/voice.py b/telegram/files/voice.py index d85f51dff..cdbaa07c9 100644 --- a/telegram/files/voice.py +++ b/telegram/files/voice.py @@ -33,16 +33,6 @@ class Voice(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - duration (:obj:`int`): Duration of the audio in seconds as defined by sender. - mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. - file_size (:obj:`int`): Optional. File size. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -55,6 +45,16 @@ class Voice(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + duration (:obj:`int`): Duration of the audio in seconds as defined by sender. + mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender. + file_size (:obj:`int`): Optional. File size. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/forcereply.py b/telegram/forcereply.py index 95fbf03ce..ad04d5f33 100644 --- a/telegram/forcereply.py +++ b/telegram/forcereply.py @@ -33,11 +33,6 @@ class ForceReply(ReplyMarkup): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`selective` is equal. - Attributes: - force_reply (:obj:`True`): Shows reply interface to the user, as if they manually selected - the bot's message and tapped 'Reply'. - selective (:obj:`bool`): Optional. Force reply from specific users only. - Args: selective (:obj:`bool`, optional): Use this parameter if you want to force reply from specific users only. Targets: @@ -48,6 +43,11 @@ class ForceReply(ReplyMarkup): **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + force_reply (:obj:`True`): Shows reply interface to the user, as if they manually selected + the bots message and tapped 'Reply'. + selective (:obj:`bool`): Optional. Force reply from specific users only. + """ def __init__(self, force_reply: bool = True, selective: bool = False, **_kwargs: Any): diff --git a/telegram/games/game.py b/telegram/games/game.py index a0d5098b4..6e83bc1bd 100644 --- a/telegram/games/game.py +++ b/telegram/games/game.py @@ -36,20 +36,6 @@ class Game(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`title`, :attr:`description` and :attr:`photo` are equal. - Attributes: - title (:obj:`str`): Title of the game. - description (:obj:`str`): Description of the game. - photo (List[:class:`telegram.PhotoSize`]): Photo that will be displayed in the game message - in chats. - text (:obj:`str`): Optional. Brief description of the game or high scores included in the - game message. Can be automatically edited to include current high scores for the game - when the bot calls :meth:`telegram.Bot.set_game_score`, or manually edited - using :meth:`telegram.Bot.edit_message_text`. - text_entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities that - appear in text, such as usernames, URLs, bot commands, etc. - animation (:class:`telegram.Animation`): Optional. Animation that will be displayed in the - game message in chats. Upload via `BotFather `_. - Args: title (:obj:`str`): Title of the game. description (:obj:`str`): Description of the game. @@ -65,6 +51,20 @@ class Game(TelegramObject): animation (:class:`telegram.Animation`, optional): Animation that will be displayed in the game message in chats. Upload via `BotFather `_. + Attributes: + title (:obj:`str`): Title of the game. + description (:obj:`str`): Description of the game. + photo (List[:class:`telegram.PhotoSize`]): Photo that will be displayed in the game message + in chats. + text (:obj:`str`): Optional. Brief description of the game or high scores included in the + game message. Can be automatically edited to include current high scores for the game + when the bot calls :meth:`telegram.Bot.set_game_score`, or manually edited + using :meth:`telegram.Bot.edit_message_text`. + text_entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities that + appear in text, such as usernames, URLs, bot commands, etc. + animation (:class:`telegram.Animation`): Optional. Animation that will be displayed in the + game message in chats. Upload via `BotFather `_. + """ def __init__( diff --git a/telegram/games/gamehighscore.py b/telegram/games/gamehighscore.py index 799a3266b..27283819b 100644 --- a/telegram/games/gamehighscore.py +++ b/telegram/games/gamehighscore.py @@ -33,12 +33,12 @@ class GameHighScore(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`position`, :attr:`user` and :attr:`score` are equal. - Attributes: + Args: position (:obj:`int`): Position in high score table for the game. user (:class:`telegram.User`): User. score (:obj:`int`): Score. - Args: + Attributes: position (:obj:`int`): Position in high score table for the game. user (:class:`telegram.User`): User. score (:obj:`int`): Score. diff --git a/telegram/inline/inlinekeyboardbutton.py b/telegram/inline/inlinekeyboardbutton.py index 580bf8c92..cf664d50c 100644 --- a/telegram/inline/inlinekeyboardbutton.py +++ b/telegram/inline/inlinekeyboardbutton.py @@ -38,23 +38,6 @@ class InlineKeyboardButton(TelegramObject): You must use exactly one of the optional fields. Mind that :attr:`callback_game` is not working as expected. Putting a game short name in it might, but is not guaranteed to work. - Attributes: - text (:obj:`str`): Label text on the button. - url (:obj:`str`): Optional. HTTP or tg:// url to be opened when button is pressed. - login_url (:class:`telegram.LoginUrl`) Optional. An HTTP URL used to automatically - authorize the user. Can be used as a replacement for the Telegram Login Widget. - callback_data (:obj:`str`): Optional. Data to be sent in a callback query to the bot when - button is pressed, UTF-8 1-64 bytes. - switch_inline_query (:obj:`str`): Optional. Will prompt the user to select one of their - chats, open that chat and insert the bot's username and the specified inline query in - the input field. Can be empty, in which case just the bot’s username will be inserted. - switch_inline_query_current_chat (:obj:`str`): Optional. Will insert the bot's username and - the specified inline query in the current chat's input field. Can be empty, in which - case just the bot’s username will be inserted. - callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will - be launched when the user presses the button. - pay (:obj:`bool`): Optional. Specify True, to send a Pay button. - Args: text (:obj:`str`): Label text on the button. url (:obj:`str`): HTTP or tg:// url to be opened when button is pressed. @@ -81,6 +64,23 @@ class InlineKeyboardButton(TelegramObject): must always be the ``first`` button in the first row. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + text (:obj:`str`): Label text on the button. + url (:obj:`str`): Optional. HTTP or tg:// url to be opened when button is pressed. + login_url (:class:`telegram.LoginUrl`) Optional. An HTTP URL used to automatically + authorize the user. Can be used as a replacement for the Telegram Login Widget. + callback_data (:obj:`str`): Optional. Data to be sent in a callback query to the bot when + button is pressed, UTF-8 1-64 bytes. + switch_inline_query (:obj:`str`): Optional. Will prompt the user to select one of their + chats, open that chat and insert the bot's username and the specified inline query in + the input field. Can be empty, in which case just the bot’s username will be inserted. + switch_inline_query_current_chat (:obj:`str`): Optional. Will insert the bot's username and + the specified inline query in the current chat's input field. Can be empty, in which + case just the bot’s username will be inserted. + callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will + be launched when the user presses the button. + pay (:obj:`bool`): Optional. Specify True, to send a Pay button. + """ def __init__( diff --git a/telegram/inline/inlinekeyboardmarkup.py b/telegram/inline/inlinekeyboardmarkup.py index 84eeb72dd..87ab3f2ef 100644 --- a/telegram/inline/inlinekeyboardmarkup.py +++ b/telegram/inline/inlinekeyboardmarkup.py @@ -34,15 +34,15 @@ class InlineKeyboardMarkup(ReplyMarkup): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their the size of :attr:`inline_keyboard` and all the buttons are equal. - Attributes: - inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]): List of button rows, - each represented by a list of InlineKeyboardButton objects. - Args: inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]): List of button rows, each represented by a list of InlineKeyboardButton objects. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + inline_keyboard (List[List[:class:`telegram.InlineKeyboardButton`]]): List of button rows, + each represented by a list of InlineKeyboardButton objects. + """ def __init__(self, inline_keyboard: List[List[InlineKeyboardButton]], **_kwargs: Any): diff --git a/telegram/inline/inlinequery.py b/telegram/inline/inlinequery.py index e47ce0a05..44b50ce49 100644 --- a/telegram/inline/inlinequery.py +++ b/telegram/inline/inlinequery.py @@ -39,14 +39,6 @@ class InlineQuery(TelegramObject): Note: * In Python `from` is a reserved word, use `from_user` instead. - Attributes: - id (:obj:`str`): Unique identifier for this query. - from_user (:class:`telegram.User`): Sender. - location (:class:`telegram.Location`): Optional. Sender location, only for bots that - request user location. - query (:obj:`str`): Text of the query (up to 256 characters). - offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot. - Args: id (:obj:`str`): Unique identifier for this query. from_user (:class:`telegram.User`): Sender. @@ -57,6 +49,14 @@ class InlineQuery(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + id (:obj:`str`): Unique identifier for this query. + from_user (:class:`telegram.User`): Sender. + location (:class:`telegram.Location`): Optional. Sender location, only for bots that + request user location. + query (:obj:`str`): Text of the query (up to 256 characters). + offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot. + """ def __init__( diff --git a/telegram/inline/inlinequeryresult.py b/telegram/inline/inlinequeryresult.py index 496af1c11..5468b266b 100644 --- a/telegram/inline/inlinequeryresult.py +++ b/telegram/inline/inlinequeryresult.py @@ -31,15 +31,15 @@ class InlineQueryResult(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. - Attributes: - type (:obj:`str`): Type of the result. - id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. - Args: type (:obj:`str`): Type of the result. id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): Type of the result. + id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. + """ def __init__(self, type: str, id: str, **_kwargs: Any): diff --git a/telegram/inline/inlinequeryresultarticle.py b/telegram/inline/inlinequeryresultarticle.py index dab6e8326..17949e0ca 100644 --- a/telegram/inline/inlinequeryresultarticle.py +++ b/telegram/inline/inlinequeryresultarticle.py @@ -29,22 +29,6 @@ if TYPE_CHECKING: class InlineQueryResultArticle(InlineQueryResult): """This object represents a Telegram InlineQueryResultArticle. - Attributes: - type (:obj:`str`): 'article'. - id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. - title (:obj:`str`): Title of the result. - input_message_content (:class:`telegram.InputMessageContent`): Content of the message to - be sent. - reply_markup (:class:`telegram.ReplyMarkup`): Optional. Inline keyboard attached to - the message. - url (:obj:`str`): Optional. URL of the result. - hide_url (:obj:`bool`): Optional. Pass :obj:`True`, if you don't want the URL to be shown - in the message. - description (:obj:`str`): Optional. Short description of the result. - thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. - thumb_width (:obj:`int`): Optional. Thumbnail width. - thumb_height (:obj:`int`): Optional. Thumbnail height. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. title (:obj:`str`): Title of the result. @@ -61,6 +45,22 @@ class InlineQueryResultArticle(InlineQueryResult): thumb_height (:obj:`int`, optional): Thumbnail height. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'article'. + id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. + title (:obj:`str`): Title of the result. + input_message_content (:class:`telegram.InputMessageContent`): Content of the message to + be sent. + reply_markup (:class:`telegram.ReplyMarkup`): Optional. Inline keyboard attached to + the message. + url (:obj:`str`): Optional. URL of the result. + hide_url (:obj:`bool`): Optional. Pass :obj:`True`, if you don't want the URL to be shown + in the message. + description (:obj:`str`): Optional. Short description of the result. + thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. + thumb_width (:obj:`int`): Optional. Thumbnail width. + thumb_height (:obj:`int`): Optional. Thumbnail height. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultaudio.py b/telegram/inline/inlinequeryresultaudio.py index 3d240be07..2a1d0b464 100644 --- a/telegram/inline/inlinequeryresultaudio.py +++ b/telegram/inline/inlinequeryresultaudio.py @@ -33,25 +33,6 @@ class InlineQueryResultAudio(InlineQueryResult): Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the audio. - Attributes: - type (:obj:`str`): 'audio'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - audio_url (:obj:`str`): A valid URL for the audio file. - title (:obj:`str`): Title. - performer (:obj:`str`): Optional. Performer. - audio_duration (:obj:`str`): Optional. Audio duration in seconds. - caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the audio. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. audio_url (:obj:`str`): A valid URL for the audio file. @@ -71,6 +52,25 @@ class InlineQueryResultAudio(InlineQueryResult): message to be sent instead of the audio. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'audio'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + audio_url (:obj:`str`): A valid URL for the audio file. + title (:obj:`str`): Title. + performer (:obj:`str`): Optional. Performer. + audio_duration (:obj:`str`): Optional. Audio duration in seconds. + caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the audio. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedaudio.py b/telegram/inline/inlinequeryresultcachedaudio.py index b0889ee88..d6902219f 100644 --- a/telegram/inline/inlinequeryresultcachedaudio.py +++ b/telegram/inline/inlinequeryresultcachedaudio.py @@ -33,22 +33,6 @@ class InlineQueryResultCachedAudio(InlineQueryResult): file will be sent by the user. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the audio. - Attributes: - type (:obj:`str`): 'audio'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - audio_file_id (:obj:`str`): A valid file identifier for the audio file. - caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the audio. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. audio_file_id (:obj:`str`): A valid file identifier for the audio file. @@ -65,6 +49,22 @@ class InlineQueryResultCachedAudio(InlineQueryResult): message to be sent instead of the audio. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'audio'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + audio_file_id (:obj:`str`): A valid file identifier for the audio file. + caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the audio. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcacheddocument.py b/telegram/inline/inlinequeryresultcacheddocument.py index 68346e912..c8e19510e 100644 --- a/telegram/inline/inlinequeryresultcacheddocument.py +++ b/telegram/inline/inlinequeryresultcacheddocument.py @@ -34,25 +34,6 @@ class InlineQueryResultCachedDocument(InlineQueryResult): by the user with an optional caption. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the file. - Attributes: - type (:obj:`str`): 'document'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - title (:obj:`str`): Title for the result. - document_file_id (:obj:`str`): A valid file identifier for the file. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the document to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption.. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the file. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. title (:obj:`str`): Title for the result. @@ -72,6 +53,25 @@ class InlineQueryResultCachedDocument(InlineQueryResult): message to be sent instead of the file. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'document'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + title (:obj:`str`): Title for the result. + document_file_id (:obj:`str`): A valid file identifier for the file. + description (:obj:`str`): Optional. Short description of the result. + caption (:obj:`str`): Optional. Caption of the document to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption.. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the file. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedgif.py b/telegram/inline/inlinequeryresultcachedgif.py index ddce04cde..b0489557a 100644 --- a/telegram/inline/inlinequeryresultcachedgif.py +++ b/telegram/inline/inlinequeryresultcachedgif.py @@ -34,24 +34,6 @@ class InlineQueryResultCachedGif(InlineQueryResult): use :attr:`input_message_content` to send a message with specified content instead of the animation. - Attributes: - type (:obj:`str`): 'gif'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - gif_file_id (:obj:`str`): A valid file identifier for the GIF file. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the GIF file to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the gif. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. gif_file_id (:obj:`str`): A valid file identifier for the GIF file. @@ -70,6 +52,24 @@ class InlineQueryResultCachedGif(InlineQueryResult): message to be sent instead of the gif. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'gif'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + gif_file_id (:obj:`str`): A valid file identifier for the GIF file. + title (:obj:`str`): Optional. Title for the result. + caption (:obj:`str`): Optional. Caption of the GIF file to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the gif. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedmpeg4gif.py b/telegram/inline/inlinequeryresultcachedmpeg4gif.py index a8dd6bef7..30387a596 100644 --- a/telegram/inline/inlinequeryresultcachedmpeg4gif.py +++ b/telegram/inline/inlinequeryresultcachedmpeg4gif.py @@ -34,24 +34,6 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): optional caption. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the animation. - Attributes: - type (:obj:`str`): 'mpeg4_gif'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the MPEG-4 file. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. @@ -70,6 +52,24 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): message to be sent instead of the MPEG-4 file. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'mpeg4_gif'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. + title (:obj:`str`): Optional. Title for the result. + caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the MPEG-4 file. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedphoto.py b/telegram/inline/inlinequeryresultcachedphoto.py index e80a9e03d..f60906dfd 100644 --- a/telegram/inline/inlinequeryresultcachedphoto.py +++ b/telegram/inline/inlinequeryresultcachedphoto.py @@ -35,25 +35,6 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): :attr:`input_message_content` to send a message with the specified content instead of the photo. - Attributes: - type (:obj:`str`): 'photo'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - photo_file_id (:obj:`str`): A valid file identifier of the photo. - title (:obj:`str`): Optional. Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-1024 characters after - entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the photo. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. photo_file_id (:obj:`str`): A valid file identifier of the photo. @@ -73,6 +54,25 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): message to be sent instead of the photo. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'photo'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + photo_file_id (:obj:`str`): A valid file identifier of the photo. + title (:obj:`str`): Optional. Title for the result. + description (:obj:`str`): Optional. Short description of the result. + caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-1024 characters after + entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the photo. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedsticker.py b/telegram/inline/inlinequeryresultcachedsticker.py index e1791049e..1bcf7d35a 100644 --- a/telegram/inline/inlinequeryresultcachedsticker.py +++ b/telegram/inline/inlinequeryresultcachedsticker.py @@ -32,15 +32,6 @@ class InlineQueryResultCachedSticker(InlineQueryResult): be sent by the user. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the sticker. - Attributes: - type (:obj:`str`): 'sticker`. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - sticker_file_id (:obj:`str`): A valid file identifier of the sticker. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the sticker. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. sticker_file_id (:obj:`str`): A valid file identifier of the sticker. @@ -50,6 +41,15 @@ class InlineQueryResultCachedSticker(InlineQueryResult): message to be sent instead of the sticker. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'sticker`. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + sticker_file_id (:obj:`str`): A valid file identifier of the sticker. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the sticker. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedvideo.py b/telegram/inline/inlinequeryresultcachedvideo.py index 3fda4456a..edc42257a 100644 --- a/telegram/inline/inlinequeryresultcachedvideo.py +++ b/telegram/inline/inlinequeryresultcachedvideo.py @@ -34,25 +34,6 @@ class InlineQueryResultCachedVideo(InlineQueryResult): :attr:`input_message_content` to send a message with the specified content instead of the video. - Attributes: - type (:obj:`str`): 'video'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - video_file_id (:obj:`str`): A valid file identifier for the video file. - title (:obj:`str`): Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the video to be sent, 0-1024 characters after - entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the video. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. video_file_id (:obj:`str`): A valid file identifier for the video file. @@ -72,6 +53,25 @@ class InlineQueryResultCachedVideo(InlineQueryResult): message to be sent instead of the video. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'video'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + video_file_id (:obj:`str`): A valid file identifier for the video file. + title (:obj:`str`): Title for the result. + description (:obj:`str`): Optional. Short description of the result. + caption (:obj:`str`): Optional. Caption of the video to be sent, 0-1024 characters after + entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the video. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcachedvoice.py b/telegram/inline/inlinequeryresultcachedvoice.py index 54314bb68..0a382fe82 100644 --- a/telegram/inline/inlinequeryresultcachedvoice.py +++ b/telegram/inline/inlinequeryresultcachedvoice.py @@ -33,23 +33,6 @@ class InlineQueryResultCachedVoice(InlineQueryResult): message will be sent by the user. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the voice message. - Attributes: - type (:obj:`str`): 'voice'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - voice_file_id (:obj:`str`): A valid file identifier for the voice message. - title (:obj:`str`): Voice message title. - caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the voice message. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. voice_file_id (:obj:`str`): A valid file identifier for the voice message. @@ -67,6 +50,23 @@ class InlineQueryResultCachedVoice(InlineQueryResult): message to be sent instead of the voice message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'voice'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + voice_file_id (:obj:`str`): A valid file identifier for the voice message. + title (:obj:`str`): Voice message title. + caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the voice message. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultcontact.py b/telegram/inline/inlinequeryresultcontact.py index d419689af..69d81ce04 100644 --- a/telegram/inline/inlinequeryresultcontact.py +++ b/telegram/inline/inlinequeryresultcontact.py @@ -32,22 +32,6 @@ class InlineQueryResultContact(InlineQueryResult): Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the contact. - Attributes: - type (:obj:`str`): 'contact'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, - 0-2048 bytes. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the contact. - thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. - thumb_width (:obj:`int`): Optional. Thumbnail width. - thumb_height (:obj:`int`): Optional. Thumbnail height. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. phone_number (:obj:`str`): Contact's phone number. @@ -64,6 +48,22 @@ class InlineQueryResultContact(InlineQueryResult): thumb_height (:obj:`int`, optional): Thumbnail height. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'contact'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + phone_number (:obj:`str`): Contact's phone number. + first_name (:obj:`str`): Contact's first name. + last_name (:obj:`str`): Optional. Contact's last name. + vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, + 0-2048 bytes. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the contact. + thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. + thumb_width (:obj:`int`): Optional. Thumbnail width. + thumb_height (:obj:`int`): Optional. Thumbnail height. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultdocument.py b/telegram/inline/inlinequeryresultdocument.py index 24e803c38..19ba01a82 100644 --- a/telegram/inline/inlinequeryresultdocument.py +++ b/telegram/inline/inlinequeryresultdocument.py @@ -34,30 +34,6 @@ class InlineQueryResultDocument(InlineQueryResult): specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. - Attributes: - type (:obj:`str`): 'document'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - title (:obj:`str`): Title for the result. - caption (:obj:`str`): Optional. Caption of the document to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - document_url (:obj:`str`): A valid URL for the file. - mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf" - or "application/zip". - description (:obj:`str`): Optional. Short description of the result. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the file. - thumb_url (:obj:`str`): Optional. URL of the thumbnail (jpeg only) for the file. - thumb_width (:obj:`int`): Optional. Thumbnail width. - thumb_height (:obj:`int`): Optional. Thumbnail height. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. title (:obj:`str`): Title for the result. @@ -82,6 +58,30 @@ class InlineQueryResultDocument(InlineQueryResult): thumb_height (:obj:`int`, optional): Thumbnail height. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'document'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + title (:obj:`str`): Title for the result. + caption (:obj:`str`): Optional. Caption of the document to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + document_url (:obj:`str`): A valid URL for the file. + mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf" + or "application/zip". + description (:obj:`str`): Optional. Short description of the result. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the file. + thumb_url (:obj:`str`): Optional. URL of the thumbnail (jpeg only) for the file. + thumb_width (:obj:`int`): Optional. Thumbnail width. + thumb_height (:obj:`int`): Optional. Thumbnail height. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultgame.py b/telegram/inline/inlinequeryresultgame.py index 9ec7823af..bae952198 100644 --- a/telegram/inline/inlinequeryresultgame.py +++ b/telegram/inline/inlinequeryresultgame.py @@ -29,13 +29,6 @@ if TYPE_CHECKING: class InlineQueryResultGame(InlineQueryResult): """Represents a :class:`telegram.Game`. - Attributes: - type (:obj:`str`): 'game'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - game_short_name (:obj:`str`): Short name of the game. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. game_short_name (:obj:`str`): Short name of the game. @@ -43,6 +36,13 @@ class InlineQueryResultGame(InlineQueryResult): to the message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'game'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + game_short_name (:obj:`str`): Short name of the game. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultgif.py b/telegram/inline/inlinequeryresultgif.py index 460d6f046..53f9c0721 100644 --- a/telegram/inline/inlinequeryresultgif.py +++ b/telegram/inline/inlinequeryresultgif.py @@ -34,30 +34,6 @@ class InlineQueryResultGif(InlineQueryResult): the user with optional caption. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the animation. - Attributes: - type (:obj:`str`): 'gif'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - gif_url (:obj:`str`): A valid URL for the GIF file. File size must not exceed 1MB. - gif_width (:obj:`int`): Optional. Width of the GIF. - gif_height (:obj:`int`): Optional. Height of the GIF. - gif_duration (:obj:`int`): Optional. Duration of the GIF. - thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for - the result. - thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the GIF file to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the GIF animation. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. gif_url (:obj:`str`): A valid URL for the GIF file. File size must not exceed 1MB. @@ -83,6 +59,30 @@ class InlineQueryResultGif(InlineQueryResult): message to be sent instead of the GIF animation. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'gif'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + gif_url (:obj:`str`): A valid URL for the GIF file. File size must not exceed 1MB. + gif_width (:obj:`int`): Optional. Width of the GIF. + gif_height (:obj:`int`): Optional. Height of the GIF. + gif_duration (:obj:`int`): Optional. Duration of the GIF. + thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for + the result. + thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail. + title (:obj:`str`): Optional. Title for the result. + caption (:obj:`str`): Optional. Caption of the GIF file to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the GIF animation. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultlocation.py b/telegram/inline/inlinequeryresultlocation.py index 87a66a9a1..dddbd492e 100644 --- a/telegram/inline/inlinequeryresultlocation.py +++ b/telegram/inline/inlinequeryresultlocation.py @@ -32,28 +32,6 @@ class InlineQueryResultLocation(InlineQueryResult): Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the location. - Attributes: - type (:obj:`str`): 'location'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - latitude (:obj:`float`): Location latitude in degrees. - longitude (:obj:`float`): Location longitude in degrees. - title (:obj:`str`): Location title. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters. - live_period (:obj:`int`): Optional. Period in seconds for which the location can be - updated, should be between 60 and 86400. - heading (:obj:`int`): Optional. For live locations, a direction in which the user is - moving, in degrees. - proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for - proximity alerts about approaching another chat member, in meters. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the location. - thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. - thumb_width (:obj:`int`): Optional. Thumbnail width. - thumb_height (:obj:`int`): Optional. Thumbnail height. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. latitude (:obj:`float`): Location latitude in degrees. @@ -77,6 +55,28 @@ class InlineQueryResultLocation(InlineQueryResult): thumb_height (:obj:`int`, optional): Thumbnail height. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'location'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + latitude (:obj:`float`): Location latitude in degrees. + longitude (:obj:`float`): Location longitude in degrees. + title (:obj:`str`): Location title. + horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, + measured in meters. + live_period (:obj:`int`): Optional. Period in seconds for which the location can be + updated, should be between 60 and 86400. + heading (:obj:`int`): Optional. For live locations, a direction in which the user is + moving, in degrees. + proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for + proximity alerts about approaching another chat member, in meters. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the location. + thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. + thumb_width (:obj:`int`): Optional. Thumbnail width. + thumb_height (:obj:`int`): Optional. Thumbnail height. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultmpeg4gif.py b/telegram/inline/inlinequeryresultmpeg4gif.py index ff9794c4e..fff6e5a34 100644 --- a/telegram/inline/inlinequeryresultmpeg4gif.py +++ b/telegram/inline/inlinequeryresultmpeg4gif.py @@ -34,30 +34,6 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): use :attr:`input_message_content` to send a message with the specified content instead of the animation. - Attributes: - type (:obj:`str`): 'mpeg4_gif'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - mpeg4_url (:obj:`str`): A valid URL for the MP4 file. File size must not exceed 1MB. - mpeg4_width (:obj:`int`): Optional. Video width. - mpeg4_height (:obj:`int`): Optional. Video height. - mpeg4_duration (:obj:`int`): Optional. Video duration. - thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for - the result. - thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail. - title (:obj:`str`): Optional. Title for the result. - caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters - after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the video animation. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. mpeg4_url (:obj:`str`): A valid URL for the MP4 file. File size must not exceed 1MB. @@ -82,6 +58,30 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): message to be sent instead of the video animation. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'mpeg4_gif'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + mpeg4_url (:obj:`str`): A valid URL for the MP4 file. File size must not exceed 1MB. + mpeg4_width (:obj:`int`): Optional. Video width. + mpeg4_height (:obj:`int`): Optional. Video height. + mpeg4_duration (:obj:`int`): Optional. Video duration. + thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for + the result. + thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail. + title (:obj:`str`): Optional. Title for the result. + caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters + after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the video animation. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultphoto.py b/telegram/inline/inlinequeryresultphoto.py index 721e23bc3..8688fba79 100644 --- a/telegram/inline/inlinequeryresultphoto.py +++ b/telegram/inline/inlinequeryresultphoto.py @@ -33,29 +33,6 @@ class InlineQueryResultPhoto(InlineQueryResult): caption. Alternatively, you can use :attr:`input_message_content` to send a message with the specified content instead of the photo. - Attributes: - type (:obj:`str`): 'photo'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - photo_url (:obj:`str`): A valid URL of the photo. Photo must be in jpeg format. Photo size - must not exceed 5MB. - thumb_url (:obj:`str`): URL of the thumbnail for the photo. - photo_width (:obj:`int`): Optional. Width of the photo. - photo_height (:obj:`int`): Optional. Height of the photo. - title (:obj:`str`): Optional. Title for the result. - description (:obj:`str`): Optional. Short description of the result. - caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-1024 characters after - entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the photo. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. photo_url (:obj:`str`): A valid URL of the photo. Photo must be in jpeg format. Photo size @@ -79,6 +56,29 @@ class InlineQueryResultPhoto(InlineQueryResult): message to be sent instead of the photo. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'photo'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + photo_url (:obj:`str`): A valid URL of the photo. Photo must be in jpeg format. Photo size + must not exceed 5MB. + thumb_url (:obj:`str`): URL of the thumbnail for the photo. + photo_width (:obj:`int`): Optional. Width of the photo. + photo_height (:obj:`int`): Optional. Height of the photo. + title (:obj:`str`): Optional. Title for the result. + description (:obj:`str`): Optional. Short description of the result. + caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-1024 characters after + entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the photo. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultvenue.py b/telegram/inline/inlinequeryresultvenue.py index 6cbee78e1..d43312be8 100644 --- a/telegram/inline/inlinequeryresultvenue.py +++ b/telegram/inline/inlinequeryresultvenue.py @@ -36,25 +36,6 @@ class InlineQueryResultVenue(InlineQueryResult): Foursquare details and Google Pace details are mutually exclusive. However, this behaviour is undocumented and might be changed by Telegram. - Attributes: - type (:obj:`str`): 'venue'. - id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. - latitude (:obj:`float`): Latitude of the venue location in degrees. - longitude (:obj:`float`): Longitude of the venue location in degrees. - title (:obj:`str`): Title of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue if known. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the venue. - thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. - thumb_width (:obj:`int`): Optional. Thumbnail width. - thumb_height (:obj:`int`): Optional. Thumbnail height. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. latitude (:obj:`float`): Latitude of the venue location in degrees. @@ -77,6 +58,25 @@ class InlineQueryResultVenue(InlineQueryResult): thumb_height (:obj:`int`, optional): Thumbnail height. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'venue'. + id (:obj:`str`): Unique identifier for this result, 1-64 Bytes. + latitude (:obj:`float`): Latitude of the venue location in degrees. + longitude (:obj:`float`): Longitude of the venue location in degrees. + title (:obj:`str`): Title of the venue. + address (:obj:`str`): Address of the venue. + foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue if known. + foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. + google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. + google_place_type (:obj:`str`): Optional. Google Places type of the venue. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the venue. + thumb_url (:obj:`str`): Optional. Url of the thumbnail for the result. + thumb_width (:obj:`int`): Optional. Thumbnail width. + thumb_height (:obj:`int`): Optional. Thumbnail height. + """ def __init__( diff --git a/telegram/inline/inlinequeryresultvideo.py b/telegram/inline/inlinequeryresultvideo.py index 75fa7901c..adccdf051 100644 --- a/telegram/inline/inlinequeryresultvideo.py +++ b/telegram/inline/inlinequeryresultvideo.py @@ -38,6 +38,31 @@ class InlineQueryResultVideo(InlineQueryResult): If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using :attr:`input_message_content`. + Args: + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + video_url (:obj:`str`): A valid URL for the embedded video player or video file. + mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". + thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video. + title (:obj:`str`): Title for the result. + caption (:obj:`str`, optional): Caption, 0-1024 characters after entities parsing. + parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`], optional): List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + video_width (:obj:`int`, optional): Video width. + video_height (:obj:`int`, optional): Video height. + video_duration (:obj:`int`, optional): Video duration in seconds. + description (:obj:`str`, optional): Short description of the result. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the + message to be sent instead of the video. This field is required if + InlineQueryResultVideo is used to send an HTML-page as a result + (e.g., a YouTube video). + **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: type (:obj:`str`): 'video'. id (:obj:`str`): Unique identifier for this result, 1-64 bytes. @@ -64,31 +89,6 @@ class InlineQueryResultVideo(InlineQueryResult): InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). - Args: - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - video_url (:obj:`str`): A valid URL for the embedded video player or video file. - mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". - thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video. - title (:obj:`str`): Title for the result. - caption (:obj:`str`, optional): Caption, 0-1024 characters after entities parsing. - parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`], optional): List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - video_width (:obj:`int`, optional): Video width. - video_height (:obj:`int`, optional): Video height. - video_duration (:obj:`int`, optional): Video duration in seconds. - description (:obj:`str`, optional): Short description of the result. - reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the - message to be sent instead of the video. This field is required if - InlineQueryResultVideo is used to send an HTML-page as a result - (e.g., a YouTube video). - **kwargs (:obj:`dict`): Arbitrary keyword arguments. - """ def __init__( diff --git a/telegram/inline/inlinequeryresultvoice.py b/telegram/inline/inlinequeryresultvoice.py index 87d3baeab..8c71d8e3a 100644 --- a/telegram/inline/inlinequeryresultvoice.py +++ b/telegram/inline/inlinequeryresultvoice.py @@ -34,24 +34,6 @@ class InlineQueryResultVoice(InlineQueryResult): :attr:`input_message_content` to send a message with the specified content instead of the the voice message. - Attributes: - type (:obj:`str`): 'voice'. - id (:obj:`str`): Unique identifier for this result, 1-64 bytes. - voice_url (:obj:`str`): A valid URL for the voice recording. - title (:obj:`str`): Recording title. - caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in the media caption. See the constants - in :class:`telegram.ParseMode` for the available modes. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - voice_duration (:obj:`int`): Optional. Recording duration in seconds. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the - message to be sent instead of the voice recording. - Args: id (:obj:`str`): Unique identifier for this result, 1-64 bytes. voice_url (:obj:`str`): A valid URL for the voice recording. @@ -70,6 +52,24 @@ class InlineQueryResultVoice(InlineQueryResult): message to be sent instead of the voice recording. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): 'voice'. + id (:obj:`str`): Unique identifier for this result, 1-64 bytes. + voice_url (:obj:`str`): A valid URL for the voice recording. + title (:obj:`str`): Recording title. + caption (:obj:`str`): Optional. Caption, 0-1024 characters after entities parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in the media caption. See the constants + in :class:`telegram.ParseMode` for the available modes. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + voice_duration (:obj:`int`): Optional. Recording duration in seconds. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the + message to be sent instead of the voice recording. + """ def __init__( diff --git a/telegram/inline/inputcontactmessagecontent.py b/telegram/inline/inputcontactmessagecontent.py index 0b2a64370..edf943d08 100644 --- a/telegram/inline/inputcontactmessagecontent.py +++ b/telegram/inline/inputcontactmessagecontent.py @@ -29,13 +29,6 @@ class InputContactMessageContent(InputMessageContent): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`phone_number` is equal. - Attributes: - phone_number (:obj:`str`): Contact's phone number. - first_name (:obj:`str`): Contact's first name. - last_name (:obj:`str`): Optional. Contact's last name. - vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, - 0-2048 bytes. - Args: phone_number (:obj:`str`): Contact's phone number. first_name (:obj:`str`): Contact's first name. @@ -44,6 +37,13 @@ class InputContactMessageContent(InputMessageContent): 0-2048 bytes. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + phone_number (:obj:`str`): Contact's phone number. + first_name (:obj:`str`): Contact's first name. + last_name (:obj:`str`): Optional. Contact's last name. + vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard, + 0-2048 bytes. + """ def __init__( diff --git a/telegram/inline/inputlocationmessagecontent.py b/telegram/inline/inputlocationmessagecontent.py index 44703e3b9..bb346cca8 100644 --- a/telegram/inline/inputlocationmessagecontent.py +++ b/telegram/inline/inputlocationmessagecontent.py @@ -31,18 +31,6 @@ class InputLocationMessageContent(InputMessageContent): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`latitude` and :attr:`longitude` are equal. - Attributes: - latitude (:obj:`float`): Latitude of the location in degrees. - longitude (:obj:`float`): Longitude of the location in degrees. - horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, - measured in meters. - live_period (:obj:`int`): Optional. Period in seconds for which the location can be - updated. - heading (:obj:`int`): Optional. For live locations, a direction in which the user is - moving, in degrees. - proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for - proximity alerts about approaching another chat member, in meters. - Args: latitude (:obj:`float`): Latitude of the location in degrees. longitude (:obj:`float`): Longitude of the location in degrees. @@ -57,6 +45,18 @@ class InputLocationMessageContent(InputMessageContent): and 100000 if specified. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + latitude (:obj:`float`): Latitude of the location in degrees. + longitude (:obj:`float`): Longitude of the location in degrees. + horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location, + measured in meters. + live_period (:obj:`int`): Optional. Period in seconds for which the location can be + updated. + heading (:obj:`int`): Optional. For live locations, a direction in which the user is + moving, in degrees. + proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for + proximity alerts about approaching another chat member, in meters. + """ # fmt: on diff --git a/telegram/inline/inputtextmessagecontent.py b/telegram/inline/inputtextmessagecontent.py index 38f3e274f..f489e065d 100644 --- a/telegram/inline/inputtextmessagecontent.py +++ b/telegram/inline/inputtextmessagecontent.py @@ -32,18 +32,6 @@ class InputTextMessageContent(InputMessageContent): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`message_text` is equal. - Attributes: - message_text (:obj:`str`): Text of the message to be sent, 1-4096 characters after entities - parsing. - parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show - bold, italic, fixed-width text or inline URLs in your bot's message. See the constants - in :class:`telegram.ParseMode` for the available modes. - entities (List[:class:`telegram.MessageEntity`]): Optional. List of special - entities that appear in the caption, which can be specified instead of - :attr:`parse_mode`. - disable_web_page_preview (:obj:`bool`): Optional. Disables link previews for links in the - sent message. - Args: message_text (:obj:`str`): Text of the message to be sent, 1-4096 characters after entities parsing. Also found as :attr:`telegram.constants.MAX_MESSAGE_LENGTH`. @@ -57,6 +45,18 @@ class InputTextMessageContent(InputMessageContent): sent message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + message_text (:obj:`str`): Text of the message to be sent, 1-4096 characters after entities + parsing. + parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show + bold, italic, fixed-width text or inline URLs in your bot's message. See the constants + in :class:`telegram.ParseMode` for the available modes. + entities (List[:class:`telegram.MessageEntity`]): Optional. List of special + entities that appear in the caption, which can be specified instead of + :attr:`parse_mode`. + disable_web_page_preview (:obj:`bool`): Optional. Disables link previews for links in the + sent message. + """ def __init__( diff --git a/telegram/inline/inputvenuemessagecontent.py b/telegram/inline/inputvenuemessagecontent.py index 4541c254b..418fada31 100644 --- a/telegram/inline/inputvenuemessagecontent.py +++ b/telegram/inline/inputvenuemessagecontent.py @@ -34,16 +34,6 @@ class InputVenueMessageContent(InputMessageContent): Foursquare details and Google Pace details are mutually exclusive. However, this behaviour is undocumented and might be changed by Telegram. - Attributes: - latitude (:obj:`float`): Latitude of the location in degrees. - longitude (:obj:`float`): Longitude of the location in degrees. - title (:obj:`str`): Name of the venue. - address (:obj:`str`): Address of the venue. - foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue, if known. - foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. - google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. - google_place_type (:obj:`str`): Optional. Google Places type of the venue. - Args: latitude (:obj:`float`): Latitude of the location in degrees. longitude (:obj:`float`): Longitude of the location in degrees. @@ -58,6 +48,16 @@ class InputVenueMessageContent(InputMessageContent): `supported types `_.) **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + latitude (:obj:`float`): Latitude of the location in degrees. + longitude (:obj:`float`): Longitude of the location in degrees. + title (:obj:`str`): Name of the venue. + address (:obj:`str`): Address of the venue. + foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue, if known. + foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known. + google_place_id (:obj:`str`): Optional. Google Places identifier of the venue. + google_place_type (:obj:`str`): Optional. Google Places type of the venue. + """ def __init__( diff --git a/telegram/keyboardbutton.py b/telegram/keyboardbutton.py index 971f4d22e..04d8d5233 100644 --- a/telegram/keyboardbutton.py +++ b/telegram/keyboardbutton.py @@ -33,13 +33,11 @@ class KeyboardButton(TelegramObject): :attr:`request_poll` are equal. Note: - Optional fields are mutually exclusive. - - Attributes: - text (:obj:`str`): Text of the button. - request_contact (:obj:`bool`): Optional. The user's phone number will be sent. - request_location (:obj:`bool`): Optional. The user's current location will be sent. - request_poll (:class:`KeyboardButtonPollType`): Optional. If the user should create a poll. + * Optional fields are mutually exclusive. + * :attr:`request_contact` and :attr:`request_location` options will only work in Telegram + versions released after 9 April, 2016. Older clients will ignore them. + * :attr:`request_poll` option will only work in Telegram versions released after 23 + January, 2020. Older clients will receive unsupported message. Args: text (:obj:`str`): Text of the button. If none of the optional fields are used, it will be @@ -52,12 +50,11 @@ class KeyboardButton(TelegramObject): asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. - Note: - :attr:`request_contact` and :attr:`request_location` options will only work in Telegram - versions released after 9 April, 2016. Older clients will ignore them. - - :attr:`request_poll` option will only work in Telegram versions released after 23 January, - 2020. Older clients will receive unsupported message. + Attributes: + text (:obj:`str`): Text of the button. + request_contact (:obj:`bool`): Optional. The user's phone number will be sent. + request_location (:obj:`bool`): Optional. The user's current location will be sent. + request_poll (:class:`KeyboardButtonPollType`): Optional. If the user should create a poll. """ diff --git a/telegram/loginurl.py b/telegram/loginurl.py index e2e6eb127..d7d8ce9a7 100644 --- a/telegram/loginurl.py +++ b/telegram/loginurl.py @@ -34,13 +34,10 @@ class LoginUrl(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`url` is equal. - Attributes: - url (:obj:`str`): An HTTP URL to be opened with user authorization data. - forward_text (:obj:`str`): Optional. New text of the button in forwarded messages. - bot_username (:obj:`str`): Optional. Username of a bot, which will be used for user - authorization. - request_write_access (:obj:`bool`): Optional. Pass :obj:`True` to request the permission - for your bot to send messages to the user. + Note: + You must always check the hash of the received data to verify the authentication + and the integrity of the data as described in + `Checking authorization `_ Args: url (:obj:`str`): An HTTP URL to be opened with user authorization data added to the query @@ -62,10 +59,14 @@ class LoginUrl(TelegramObject): request_write_access (:obj:`bool`, optional): Pass :obj:`True` to request the permission for your bot to send messages to the user. - Note: - You must always check the hash of the received data to verify the authentication - and the integrity of the data as described in - `Checking authorization `_ + Attributes: + url (:obj:`str`): An HTTP URL to be opened with user authorization data. + forward_text (:obj:`str`): Optional. New text of the button in forwarded messages. + bot_username (:obj:`str`): Optional. Username of a bot, which will be used for user + authorization. + request_write_access (:obj:`bool`): Optional. Pass :obj:`True` to request the permission + for your bot to send messages to the user. + """ def __init__( diff --git a/telegram/message.py b/telegram/message.py index 9195ecb34..14a554cff 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -82,92 +82,7 @@ class Message(TelegramObject): considered equal, if their :attr:`message_id` and :attr:`chat` are equal. Note: - * In Python `from` is a reserved word, use `from_user` instead. - - Attributes: - message_id (:obj:`int`): Unique message identifier inside this chat. - from_user (:class:`telegram.User`): Optional. Sender. - sender_chat (:class:`telegram.Chat`): Optional. Sender of the message, sent on behalf of a - chat. The channel itself for channel messages. The supergroup itself for messages from - anonymous group administrators. The linked channel for messages automatically forwarded - to the discussion group. - date (:class:`datetime.datetime`): Date the message was sent. - chat (:class:`telegram.Chat`): Conversation the message belongs to. - forward_from (:class:`telegram.User`): Optional. Sender of the original message. - forward_from_chat (:class:`telegram.Chat`): Optional. For messages forwarded from channels - or from anonymous administrators, information about the original sender chat. - forward_from_message_id (:obj:`int`): Optional. Identifier of the original message in the - channel. - forward_date (:class:`datetime.datetime`): Optional. Date the original message was sent. - reply_to_message (:class:`telegram.Message`): Optional. For replies, the original message. - Note that the Message object in this field will not contain further - ``reply_to_message`` fields even if it itself is a reply. - edit_date (:class:`datetime.datetime`): Optional. Date the message was last edited. - media_group_id (:obj:`str`): Optional. The unique identifier of a media message group this - message belongs to. - text (:obj:`str`): Optional. The actual UTF-8 text of the message. - entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities like - usernames, URLs, bot commands, etc. that appear in the text. See - :attr:`Message.parse_entity` and :attr:`parse_entities` methods for how to use - properly. - caption_entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities like - usernames, URLs, bot commands, etc. that appear in the caption. See - :attr:`Message.parse_caption_entity` and :attr:`parse_caption_entities` methods for how - to use properly. - audio (:class:`telegram.Audio`): Optional. Information about the file. - document (:class:`telegram.Document`): Optional. Information about the file. - animation (:class:`telegram.Animation`) Optional. Information about the file. - For backward compatibility, when this field is set, the document field will also be - set. - game (:class:`telegram.Game`): Optional. Information about the game. - photo (List[:class:`telegram.PhotoSize`]): Optional. Available sizes of the photo. - sticker (:class:`telegram.Sticker`): Optional. Information about the sticker. - video (:class:`telegram.Video`): Optional. Information about the video. - voice (:class:`telegram.Voice`): Optional. Information about the file. - video_note (:class:`telegram.VideoNote`): Optional. Information about the video message. - new_chat_members (List[:class:`telegram.User`]): Optional. Information about new members to - the chat. (the bot itself may be one of these members). - caption (:obj:`str`): Optional. Caption for the document, photo or video, 0-1024 - characters. - contact (:class:`telegram.Contact`): Optional. Information about the contact. - location (:class:`telegram.Location`): Optional. Information about the location. - venue (:class:`telegram.Venue`): Optional. Information about the venue. - left_chat_member (:class:`telegram.User`): Optional. Information about the user that left - the group. (this member may be the bot itself). - new_chat_title (:obj:`str`): Optional. A chat title was changed to this value. - new_chat_photo (List[:class:`telegram.PhotoSize`]): Optional. A chat photo was changed to - this value. - delete_chat_photo (:obj:`bool`): Optional. The chat photo was deleted. - group_chat_created (:obj:`bool`): Optional. The group has been created. - supergroup_chat_created (:obj:`bool`): Optional. The supergroup has been created. - channel_chat_created (:obj:`bool`): Optional. The channel has been created. - migrate_to_chat_id (:obj:`int`): Optional. The group has been migrated to a supergroup with - the specified identifier. - migrate_from_chat_id (:obj:`int`): Optional. The supergroup has been migrated from a group - with the specified identifier. - pinned_message (:class:`telegram.message`): Optional. Specified message was pinned. - invoice (:class:`telegram.Invoice`): Optional. Information about the invoice. - successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Information about the - payment. - connected_website (:obj:`str`): Optional. The domain name of the website on which the user - has logged in. - forward_signature (:obj:`str`): Optional. Signature of the post author for messages - forwarded from channels. - forward_sender_name (:obj:`str`): Optional. Sender's name for messages forwarded from users - who disallow adding a link to their account in forwarded messages. - author_signature (:obj:`str`): Optional. Signature of the post author for messages in - channels, or the custom title of an anonymous group administrator. - passport_data (:class:`telegram.PassportData`): Optional. Telegram Passport data. - poll (:class:`telegram.Poll`): Optional. Message is a native poll, - information about the poll. - dice (:class:`telegram.Dice`): Optional. Message is a dice. - via_bot (:class:`telegram.User`): Optional. Bot through which the message was sent. - proximity_alert_triggered (:class:`telegram.ProximityAlertTriggered`): Optional. Service - message. A user in the chat triggered another user's proximity alert while sharing - Live Location. - reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached - to the message. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + In Python `from` is a reserved word, use `from_user` instead. Args: message_id (:obj:`int`): Unique message identifier inside this chat. @@ -284,6 +199,91 @@ class Message(TelegramObject): to the message. ``login_url`` buttons are represented as ordinary url buttons. bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. + Attributes: + message_id (:obj:`int`): Unique message identifier inside this chat. + from_user (:class:`telegram.User`): Optional. Sender. + sender_chat (:class:`telegram.Chat`): Optional. Sender of the message, sent on behalf of a + chat. The channel itself for channel messages. The supergroup itself for messages from + anonymous group administrators. The linked channel for messages automatically forwarded + to the discussion group. + date (:class:`datetime.datetime`): Date the message was sent. + chat (:class:`telegram.Chat`): Conversation the message belongs to. + forward_from (:class:`telegram.User`): Optional. Sender of the original message. + forward_from_chat (:class:`telegram.Chat`): Optional. For messages forwarded from channels + or from anonymous administrators, information about the original sender chat. + forward_from_message_id (:obj:`int`): Optional. Identifier of the original message in the + channel. + forward_date (:class:`datetime.datetime`): Optional. Date the original message was sent. + reply_to_message (:class:`telegram.Message`): Optional. For replies, the original message. + Note that the Message object in this field will not contain further + ``reply_to_message`` fields even if it itself is a reply. + edit_date (:class:`datetime.datetime`): Optional. Date the message was last edited. + media_group_id (:obj:`str`): Optional. The unique identifier of a media message group this + message belongs to. + text (:obj:`str`): Optional. The actual UTF-8 text of the message. + entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities like + usernames, URLs, bot commands, etc. that appear in the text. See + :attr:`Message.parse_entity` and :attr:`parse_entities` methods for how to use + properly. + caption_entities (List[:class:`telegram.MessageEntity`]): Optional. Special entities like + usernames, URLs, bot commands, etc. that appear in the caption. See + :attr:`Message.parse_caption_entity` and :attr:`parse_caption_entities` methods for how + to use properly. + audio (:class:`telegram.Audio`): Optional. Information about the file. + document (:class:`telegram.Document`): Optional. Information about the file. + animation (:class:`telegram.Animation`) Optional. Information about the file. + For backward compatibility, when this field is set, the document field will also be + set. + game (:class:`telegram.Game`): Optional. Information about the game. + photo (List[:class:`telegram.PhotoSize`]): Optional. Available sizes of the photo. + sticker (:class:`telegram.Sticker`): Optional. Information about the sticker. + video (:class:`telegram.Video`): Optional. Information about the video. + voice (:class:`telegram.Voice`): Optional. Information about the file. + video_note (:class:`telegram.VideoNote`): Optional. Information about the video message. + new_chat_members (List[:class:`telegram.User`]): Optional. Information about new members to + the chat. (the bot itself may be one of these members). + caption (:obj:`str`): Optional. Caption for the document, photo or video, 0-1024 + characters. + contact (:class:`telegram.Contact`): Optional. Information about the contact. + location (:class:`telegram.Location`): Optional. Information about the location. + venue (:class:`telegram.Venue`): Optional. Information about the venue. + left_chat_member (:class:`telegram.User`): Optional. Information about the user that left + the group. (this member may be the bot itself). + new_chat_title (:obj:`str`): Optional. A chat title was changed to this value. + new_chat_photo (List[:class:`telegram.PhotoSize`]): Optional. A chat photo was changed to + this value. + delete_chat_photo (:obj:`bool`): Optional. The chat photo was deleted. + group_chat_created (:obj:`bool`): Optional. The group has been created. + supergroup_chat_created (:obj:`bool`): Optional. The supergroup has been created. + channel_chat_created (:obj:`bool`): Optional. The channel has been created. + migrate_to_chat_id (:obj:`int`): Optional. The group has been migrated to a supergroup with + the specified identifier. + migrate_from_chat_id (:obj:`int`): Optional. The supergroup has been migrated from a group + with the specified identifier. + pinned_message (:class:`telegram.message`): Optional. Specified message was pinned. + invoice (:class:`telegram.Invoice`): Optional. Information about the invoice. + successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Information about the + payment. + connected_website (:obj:`str`): Optional. The domain name of the website on which the user + has logged in. + forward_signature (:obj:`str`): Optional. Signature of the post author for messages + forwarded from channels. + forward_sender_name (:obj:`str`): Optional. Sender's name for messages forwarded from users + who disallow adding a link to their account in forwarded messages. + author_signature (:obj:`str`): Optional. Signature of the post author for messages in + channels, or the custom title of an anonymous group administrator. + passport_data (:class:`telegram.PassportData`): Optional. Telegram Passport data. + poll (:class:`telegram.Poll`): Optional. Message is a native poll, + information about the poll. + dice (:class:`telegram.Dice`): Optional. Message is a dice. + via_bot (:class:`telegram.User`): Optional. Bot through which the message was sent. + proximity_alert_triggered (:class:`telegram.ProximityAlertTriggered`): Optional. Service + message. A user in the chat triggered another user's proximity alert while sharing + Live Location. + reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached + to the message. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ # fmt: on diff --git a/telegram/messageentity.py b/telegram/messageentity.py index 920c1f71d..29c6ce738 100644 --- a/telegram/messageentity.py +++ b/telegram/messageentity.py @@ -35,14 +35,6 @@ class MessageEntity(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type`, :attr:`offset` and :attr`length` are equal. - Attributes: - type (:obj:`str`): Type of the entity. - offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity. - length (:obj:`int`): Length of the entity in UTF-16 code units. - url (:obj:`str`): Optional. Url that will be opened after user taps on the text. - user (:class:`telegram.User`): Optional. The mentioned user. - language (:obj:`str`): Optional. Programming language of the entity text. - Args: type (:obj:`str`): Type of the entity. Can be mention (@username), hashtag, bot_command, url, email, phone_number, bold (bold text), italic (italic text), strikethrough, @@ -57,6 +49,14 @@ class MessageEntity(TelegramObject): language (:obj:`str`, optional): For :attr:`PRE` only, the programming language of the entity text. + Attributes: + type (:obj:`str`): Type of the entity. + offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity. + length (:obj:`int`): Length of the entity in UTF-16 code units. + url (:obj:`str`): Optional. Url that will be opened after user taps on the text. + user (:class:`telegram.User`): Optional. The mentioned user. + language (:obj:`str`): Optional. Programming language of the entity text. + """ def __init__( diff --git a/telegram/passport/credentials.py b/telegram/passport/credentials.py index 8552db176..293dbc669 100644 --- a/telegram/passport/credentials.py +++ b/telegram/passport/credentials.py @@ -110,12 +110,9 @@ class EncryptedCredentials(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`data`, :attr:`hash` and :attr:`secret` are equal. - Attributes: - data (:class:`telegram.Credentials` or :obj:`str`): Decrypted data with unique user's - nonce, data hashes and secrets used for EncryptedPassportElement decryption and - authentication or base64 encrypted data. - hash (:obj:`str`): Base64-encoded data hash for data authentication. - secret (:obj:`str`): Decrypted or encrypted secret used for decryption. + Note: + This object is decrypted only when originating from + :obj:`telegram.PassportData.decrypted_credentials`. Args: data (:class:`telegram.Credentials` or :obj:`str`): Decrypted data with unique user's @@ -125,9 +122,12 @@ class EncryptedCredentials(TelegramObject): secret (:obj:`str`): Decrypted or encrypted secret used for decryption. **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - This object is decrypted only when originating from - :obj:`telegram.PassportData.decrypted_credentials`. + Attributes: + data (:class:`telegram.Credentials` or :obj:`str`): Decrypted data with unique user's + nonce, data hashes and secrets used for EncryptedPassportElement decryption and + authentication or base64 encrypted data. + hash (:obj:`str`): Base64-encoded data hash for data authentication. + secret (:obj:`str`): Decrypted or encrypted secret used for decryption. """ diff --git a/telegram/passport/encryptedpassportelement.py b/telegram/passport/encryptedpassportelement.py index 5f8372e23..5743021df 100644 --- a/telegram/passport/encryptedpassportelement.py +++ b/telegram/passport/encryptedpassportelement.py @@ -43,39 +43,9 @@ class EncryptedPassportElement(TelegramObject): considered equal, if their :attr:`type`, :attr:`data`, :attr:`phone_number`, :attr:`email`, :attr:`files`, :attr:`front_side`, :attr:`reverse_side` and :attr:`selfie` are equal. - Attributes: - type (:obj:`str`): Element type. One of "personal_details", "passport", "driver_license", - "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", - "rental_agreement", "passport_registration", "temporary_registration", "phone_number", - "email". - data (:class:`telegram.PersonalDetails` | :class:`telegram.IdDocument` | \ - :class:`telegram.ResidentialAddress` | :obj:`str`): - Optional. Decrypted or encrypted data, available for "personal_details", "passport", - "driver_license", "identity_card", "identity_passport" and "address" types. - phone_number (:obj:`str`): Optional. User's verified phone number, available only for - "phone_number" type. - email (:obj:`str`): Optional. User's verified email address, available only for "email" - type. - files (List[:class:`telegram.PassportFile`]): Optional. Array of encrypted/decrypted files - with documents provided by the user, available for "utility_bill", "bank_statement", - "rental_agreement", "passport_registration" and "temporary_registration" types. - front_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - front side of the document, provided by the user. Available for "passport", - "driver_license", "identity_card" and "internal_passport". - reverse_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - reverse side of the document, provided by the user. Available for "driver_license" and - "identity_card". - selfie (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the - selfie of the user holding a document, provided by the user; available for "passport", - "driver_license", "identity_card" and "internal_passport". - translation (List[:class:`telegram.PassportFile`]): Optional. Array of encrypted/decrypted - files with translated versions of documents provided by the user. Available if - requested for "passport", "driver_license", "identity_card", "internal_passport", - "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and - "temporary_registration" types. - hash (:obj:`str`): Base64-encoded element hash for using in - :class:`telegram.PassportElementErrorUnspecified`. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + Note: + This object is decrypted only when originating from + :obj:`telegram.PassportData.decrypted_data`. Args: type (:obj:`str`): Element type. One of "personal_details", "passport", "driver_license", @@ -112,9 +82,40 @@ class EncryptedPassportElement(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - This object is decrypted only when originating from - :obj:`telegram.PassportData.decrypted_data`. + Attributes: + type (:obj:`str`): Element type. One of "personal_details", "passport", "driver_license", + "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", + "rental_agreement", "passport_registration", "temporary_registration", "phone_number", + "email". + data (:class:`telegram.PersonalDetails` | :class:`telegram.IdDocument` | \ + :class:`telegram.ResidentialAddress` | :obj:`str`): + Optional. Decrypted or encrypted data, available for "personal_details", "passport", + "driver_license", "identity_card", "identity_passport" and "address" types. + phone_number (:obj:`str`): Optional. User's verified phone number, available only for + "phone_number" type. + email (:obj:`str`): Optional. User's verified email address, available only for "email" + type. + files (List[:class:`telegram.PassportFile`]): Optional. Array of encrypted/decrypted files + with documents provided by the user, available for "utility_bill", "bank_statement", + "rental_agreement", "passport_registration" and "temporary_registration" types. + front_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the + front side of the document, provided by the user. Available for "passport", + "driver_license", "identity_card" and "internal_passport". + reverse_side (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the + reverse side of the document, provided by the user. Available for "driver_license" and + "identity_card". + selfie (:class:`telegram.PassportFile`): Optional. Encrypted/decrypted file with the + selfie of the user holding a document, provided by the user; available for "passport", + "driver_license", "identity_card" and "internal_passport". + translation (List[:class:`telegram.PassportFile`]): Optional. Array of encrypted/decrypted + files with translated versions of documents provided by the user. Available if + requested for "passport", "driver_license", "identity_card", "internal_passport", + "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and + "temporary_registration" types. + hash (:obj:`str`): Base64-encoded element hash for using in + :class:`telegram.PassportElementErrorUnspecified`. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/passport/passportdata.py b/telegram/passport/passportdata.py index 8106483f5..d7f450108 100644 --- a/telegram/passport/passportdata.py +++ b/telegram/passport/passportdata.py @@ -30,11 +30,11 @@ if TYPE_CHECKING: class PassportData(TelegramObject): """Contains information about Telegram Passport data shared with the bot by the user. - Attributes: - data (List[:class:`telegram.EncryptedPassportElement`]): Array with encrypted information - about documents and other Telegram Passport elements that was shared with the bot. - credentials (:class:`telegram.EncryptedCredentials`): Encrypted credentials. - bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. + Note: + To be able to decrypt this object, you must pass your ``private_key`` to either + :class:`telegram.Updater` or :class:`telegram.Bot`. Decrypted data is then found in + :attr:`decrypted_data` and the payload can be found in :attr:`decrypted_credentials`'s + attribute :attr:`telegram.Credentials.payload`. Args: data (List[:class:`telegram.EncryptedPassportElement`]): Array with encrypted information @@ -43,11 +43,11 @@ class PassportData(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - To be able to decrypt this object, you must pass your private_key to either - :class:`telegram.Updater` or :class:`telegram.Bot`. Decrypted data is then found in - :attr:`decrypted_data` and the payload can be found in :attr:`decrypted_credentials`'s - attribute :attr:`telegram.Credentials.payload`. + Attributes: + data (List[:class:`telegram.EncryptedPassportElement`]): Array with encrypted information + about documents and other Telegram Passport elements that was shared with the bot. + credentials (:class:`telegram.EncryptedCredentials`): Encrypted credentials. + bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. """ diff --git a/telegram/passport/passportelementerrors.py b/telegram/passport/passportelementerrors.py index f9a281bc1..044b0098d 100644 --- a/telegram/passport/passportelementerrors.py +++ b/telegram/passport/passportelementerrors.py @@ -30,16 +30,16 @@ class PassportElementError(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`source` and :attr:`type` are equal. - Attributes: - source (:obj:`str`): Error source. - type (:obj:`str`): The section of the user's Telegram Passport which has the error. - message (:obj:`str`): Error message. - Args: source (:obj:`str`): Error source. type (:obj:`str`): The section of the user's Telegram Passport which has the error. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + source (:obj:`str`): Error source. + type (:obj:`str`): The section of the user's Telegram Passport which has the error. + message (:obj:`str`): Error message. + """ def __init__(self, source: str, type: str, message: str, **_kwargs: Any): @@ -60,14 +60,6 @@ class PassportElementErrorDataField(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`field_name`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the error, one of - "personal_details", "passport", "driver_license", "identity_card", "internal_passport", - "address". - field_name (:obj:`str`): Name of the data field which has the error. - data_hash (:obj:`str`): Base64-encoded data hash. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the error, one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", @@ -77,6 +69,14 @@ class PassportElementErrorDataField(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the error, one of + "personal_details", "passport", "driver_license", "identity_card", "internal_passport", + "address". + field_name (:obj:`str`): Name of the data field which has the error. + data_hash (:obj:`str`): Base64-encoded data hash. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, field_name: str, data_hash: str, message: str, **_kwargs: Any): @@ -97,13 +97,6 @@ class PassportElementErrorFile(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - "utility_bill", "bank_statement", "rental_agreement", "passport_registration", - "temporary_registration". - file_hash (:obj:`str`): Base64-encoded file hash. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", @@ -112,6 +105,13 @@ class PassportElementErrorFile(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of + "utility_bill", "bank_statement", "rental_agreement", "passport_registration", + "temporary_registration". + file_hash (:obj:`str`): Base64-encoded file hash. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hash: str, message: str, **_kwargs: Any): @@ -131,13 +131,6 @@ class PassportElementErrorFiles(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hashes`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - "utility_bill", "bank_statement", "rental_agreement", "passport_registration", - "temporary_registration". - file_hashes (List[:obj:`str`]): List of base64-encoded file hashes. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", @@ -146,6 +139,13 @@ class PassportElementErrorFiles(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of + "utility_bill", "bank_statement", "rental_agreement", "passport_registration", + "temporary_registration". + file_hashes (List[:obj:`str`]): List of base64-encoded file hashes. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hashes: str, message: str, **_kwargs: Any): @@ -165,13 +165,6 @@ class PassportElementErrorFrontSide(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - "passport", "driver_license", "identity_card", "internal_passport". - file_hash (:obj:`str`): Base64-encoded hash of the file with the front side of the - document. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport". @@ -180,6 +173,13 @@ class PassportElementErrorFrontSide(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of + "passport", "driver_license", "identity_card", "internal_passport". + file_hash (:obj:`str`): Base64-encoded hash of the file with the front side of the + document. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hash: str, message: str, **_kwargs: Any): @@ -199,13 +199,6 @@ class PassportElementErrorReverseSide(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - "passport", "driver_license", "identity_card", "internal_passport". - file_hash (:obj:`str`): Base64-encoded hash of the file with the reverse side of the - document. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of "driver_license", "identity_card". @@ -214,6 +207,13 @@ class PassportElementErrorReverseSide(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of + "passport", "driver_license", "identity_card", "internal_passport". + file_hash (:obj:`str`): Base64-encoded hash of the file with the reverse side of the + document. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hash: str, message: str, **_kwargs: Any): @@ -233,12 +233,6 @@ class PassportElementErrorSelfie(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of - "passport", "driver_license", "identity_card", "internal_passport". - file_hash (:obj:`str`): Base64-encoded hash of the file with the selfie. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport". @@ -246,6 +240,12 @@ class PassportElementErrorSelfie(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): The section of the user's Telegram Passport which has the issue, one of + "passport", "driver_license", "identity_card", "internal_passport". + file_hash (:obj:`str`): Base64-encoded hash of the file with the selfie. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hash: str, message: str, **_kwargs: Any): @@ -265,14 +265,6 @@ class PassportElementErrorTranslationFile(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, - one of "passport", "driver_license", "identity_card", "internal_passport", - "utility_bill", "bank_statement", "rental_agreement", "passport_registration", - "temporary_registration". - file_hash (:obj:`str`): Base64-encoded hash of the file. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", @@ -282,6 +274,14 @@ class PassportElementErrorTranslationFile(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, + one of "passport", "driver_license", "identity_card", "internal_passport", + "utility_bill", "bank_statement", "rental_agreement", "passport_registration", + "temporary_registration". + file_hash (:obj:`str`): Base64-encoded hash of the file. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hash: str, message: str, **_kwargs: Any): @@ -301,14 +301,6 @@ class PassportElementErrorTranslationFiles(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`file_hashes`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, - one of "passport", "driver_license", "identity_card", "internal_passport", - "utility_bill", "bank_statement", "rental_agreement", "passport_registration", - "temporary_registration" - file_hashes (List[:obj:`str`]): List of base64-encoded file hashes. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", @@ -318,6 +310,14 @@ class PassportElementErrorTranslationFiles(PassportElementError): message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue, + one of "passport", "driver_license", "identity_card", "internal_passport", + "utility_bill", "bank_statement", "rental_agreement", "passport_registration", + "temporary_registration" + file_hashes (List[:obj:`str`]): List of base64-encoded file hashes. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, file_hashes: str, message: str, **_kwargs: Any): @@ -337,17 +337,17 @@ class PassportElementErrorUnspecified(PassportElementError): considered equal, if their :attr:`source`, :attr:`type`, :attr:`element_hash`, :attr:`data_hash` and :attr:`message` are equal. - Attributes: - type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue. - element_hash (:obj:`str`): Base64-encoded element hash. - message (:obj:`str`): Error message. - Args: type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue. element_hash (:obj:`str`): Base64-encoded element hash. message (:obj:`str`): Error message. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + type (:obj:`str`): Type of element of the user's Telegram Passport which has the issue. + element_hash (:obj:`str`): Base64-encoded element hash. + message (:obj:`str`): Error message. + """ def __init__(self, type: str, element_hash: str, message: str, **_kwargs: Any): diff --git a/telegram/passport/passportfile.py b/telegram/passport/passportfile.py index c60a325a6..2ff0601fc 100644 --- a/telegram/passport/passportfile.py +++ b/telegram/passport/passportfile.py @@ -35,15 +35,6 @@ class PassportFile(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`file_unique_id` is equal. - Attributes: - file_id (:obj:`str`): Identifier for this file. - file_unique_id (:obj:`str`): Unique identifier for this file, which - is supposed to be the same over time and for different bots. - Can't be used to download or reuse the file. - file_size (:obj:`int`): File size. - file_date (:obj:`int`): Unix time when the file was uploaded. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: file_id (:obj:`str`): Identifier for this file, which can be used to download or reuse the file. @@ -55,6 +46,15 @@ class PassportFile(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + file_id (:obj:`str`): Identifier for this file. + file_unique_id (:obj:`str`): Unique identifier for this file, which + is supposed to be the same over time and for different bots. + Can't be used to download or reuse the file. + file_size (:obj:`int`): File size. + file_date (:obj:`int`): Unix time when the file was uploaded. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/payment/invoice.py b/telegram/payment/invoice.py index 93336cd98..183fb51c5 100644 --- a/telegram/payment/invoice.py +++ b/telegram/payment/invoice.py @@ -30,13 +30,6 @@ class Invoice(TelegramObject): considered equal, if their :attr:`title`, :attr:`description`, :attr:`start_parameter`, :attr:`currency` and :attr:`total_amount` are equal. - Attributes: - title (:obj:`str`): Product name. - description (:obj:`str`): Product description. - start_parameter (:obj:`str`): Unique bot deep-linking parameter. - currency (:obj:`str`): Three-letter ISO 4217 currency code. - total_amount (:obj:`int`): Total price in the smallest units of the currency. - Args: title (:obj:`str`): Product name. description (:obj:`str`): Product description. @@ -51,6 +44,13 @@ class Invoice(TelegramObject): (2 for the majority of currencies). **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + title (:obj:`str`): Product name. + description (:obj:`str`): Product description. + start_parameter (:obj:`str`): Unique bot deep-linking parameter. + currency (:obj:`str`): Three-letter ISO 4217 currency code. + total_amount (:obj:`int`): Total price in the smallest units of the currency. + """ def __init__( diff --git a/telegram/payment/labeledprice.py b/telegram/payment/labeledprice.py index 714a12550..9d029ac7a 100644 --- a/telegram/payment/labeledprice.py +++ b/telegram/payment/labeledprice.py @@ -29,10 +29,6 @@ class LabeledPrice(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`label` and :attr:`amount` are equal. - Attributes: - label (:obj:`str`): Portion label. - amount (:obj:`int`): Price of the product in the smallest units of the currency. - Args: label (:obj:`str`): Portion label. amount (:obj:`int`): Price of the product in the smallest units of the currency (integer, @@ -43,6 +39,10 @@ class LabeledPrice(TelegramObject): (2 for the majority of currencies). **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + label (:obj:`str`): Portion label. + amount (:obj:`int`): Price of the product in the smallest units of the currency. + """ def __init__(self, label: str, amount: int, **_kwargs: Any): diff --git a/telegram/payment/orderinfo.py b/telegram/payment/orderinfo.py index 71e72624d..3bd593ffa 100644 --- a/telegram/payment/orderinfo.py +++ b/telegram/payment/orderinfo.py @@ -34,12 +34,6 @@ class OrderInfo(TelegramObject): considered equal, if their :attr:`name`, :attr:`phone_number`, :attr:`email` and :attr:`shipping_address` are equal. - Attributes: - name (:obj:`str`): Optional. User name. - phone_number (:obj:`str`): Optional. User's phone number. - email (:obj:`str`): Optional. User email. - shipping_address (:class:`telegram.ShippingAddress`): Optional. User shipping address. - Args: name (:obj:`str`, optional): User name. phone_number (:obj:`str`, optional): User's phone number. @@ -47,6 +41,12 @@ class OrderInfo(TelegramObject): shipping_address (:class:`telegram.ShippingAddress`, optional): User shipping address. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + name (:obj:`str`): Optional. User name. + phone_number (:obj:`str`): Optional. User's phone number. + email (:obj:`str`): Optional. User email. + shipping_address (:class:`telegram.ShippingAddress`): Optional. User shipping address. + """ def __init__( diff --git a/telegram/payment/precheckoutquery.py b/telegram/payment/precheckoutquery.py index 748c145b3..72537966e 100644 --- a/telegram/payment/precheckoutquery.py +++ b/telegram/payment/precheckoutquery.py @@ -34,18 +34,7 @@ class PreCheckoutQuery(TelegramObject): considered equal, if their :attr:`id` is equal. Note: - * In Python `from` is a reserved word, use `from_user` instead. - - Attributes: - id (:obj:`str`): Unique query identifier. - from_user (:class:`telegram.User`): User who sent the query. - currency (:obj:`str`): Three-letter ISO 4217 currency code. - total_amount (:obj:`int`): Total price in the smallest units of the currency. - invoice_payload (:obj:`str`): Bot specified invoice payload. - shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the - user. - order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + In Python `from` is a reserved word, use `from_user` instead. Args: id (:obj:`str`): Unique query identifier. @@ -64,6 +53,17 @@ class PreCheckoutQuery(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + id (:obj:`str`): Unique query identifier. + from_user (:class:`telegram.User`): User who sent the query. + currency (:obj:`str`): Three-letter ISO 4217 currency code. + total_amount (:obj:`int`): Total price in the smallest units of the currency. + invoice_payload (:obj:`str`): Bot specified invoice payload. + shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the + user. + order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/payment/shippingaddress.py b/telegram/payment/shippingaddress.py index f7c2cded7..5ddc6e94a 100644 --- a/telegram/payment/shippingaddress.py +++ b/telegram/payment/shippingaddress.py @@ -30,14 +30,6 @@ class ShippingAddress(TelegramObject): considered equal, if their :attr:`country_code`, :attr:`state`, :attr:`city`, :attr:`street_line1`, :attr:`street_line2` and :attr:`post_cod` are equal. - Attributes: - country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. - state (:obj:`str`): State, if applicable. - city (:obj:`str`): City. - street_line1 (:obj:`str`): First line for the address. - street_line2 (:obj:`str`): Second line for the address. - post_code (:obj:`str`): Address post code. - Args: country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. state (:obj:`str`): State, if applicable. @@ -47,6 +39,14 @@ class ShippingAddress(TelegramObject): post_code (:obj:`str`): Address post code. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + country_code (:obj:`str`): ISO 3166-1 alpha-2 country code. + state (:obj:`str`): State, if applicable. + city (:obj:`str`): City. + street_line1 (:obj:`str`): First line for the address. + street_line2 (:obj:`str`): Second line for the address. + post_code (:obj:`str`): Address post code. + """ def __init__( diff --git a/telegram/payment/shippingoption.py b/telegram/payment/shippingoption.py index 8da30ace6..c6fc4506b 100644 --- a/telegram/payment/shippingoption.py +++ b/telegram/payment/shippingoption.py @@ -33,17 +33,17 @@ class ShippingOption(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. - Attributes: - id (:obj:`str`): Shipping option identifier. - title (:obj:`str`): Option title. - prices (List[:class:`telegram.LabeledPrice`]): List of price portions. - Args: id (:obj:`str`): Shipping option identifier. title (:obj:`str`): Option title. prices (List[:class:`telegram.LabeledPrice`]): List of price portions. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + id (:obj:`str`): Shipping option identifier. + title (:obj:`str`): Option title. + prices (List[:class:`telegram.LabeledPrice`]): List of price portions. + """ def __init__( diff --git a/telegram/payment/shippingquery.py b/telegram/payment/shippingquery.py index 041be2fdb..d9c4bc1ac 100644 --- a/telegram/payment/shippingquery.py +++ b/telegram/payment/shippingquery.py @@ -34,14 +34,7 @@ class ShippingQuery(TelegramObject): considered equal, if their :attr:`id` is equal. Note: - * In Python `from` is a reserved word, use `from_user` instead. - - Attributes: - id (:obj:`str`): Unique query identifier. - from_user (:class:`telegram.User`): User who sent the query. - invoice_payload (:obj:`str`): Bot specified invoice payload. - shipping_address (:class:`telegram.ShippingAddress`): User specified shipping address. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + In Python `from` is a reserved word, use `from_user` instead. Args: id (:obj:`str`): Unique query identifier. @@ -51,6 +44,13 @@ class ShippingQuery(TelegramObject): bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + id (:obj:`str`): Unique query identifier. + from_user (:class:`telegram.User`): User who sent the query. + invoice_payload (:obj:`str`): Bot specified invoice payload. + shipping_address (:class:`telegram.ShippingAddress`): User specified shipping address. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/payment/successfulpayment.py b/telegram/payment/successfulpayment.py index 9aa9c6614..828a39d7c 100644 --- a/telegram/payment/successfulpayment.py +++ b/telegram/payment/successfulpayment.py @@ -34,16 +34,6 @@ class SuccessfulPayment(TelegramObject): considered equal, if their :attr:`telegram_payment_charge_id` and :attr:`provider_payment_charge_id` are equal. - Attributes: - currency (:obj:`str`): Three-letter ISO 4217 currency code. - total_amount (:obj:`int`): Total price in the smallest units of the currency. - invoice_payload (:obj:`str`): Bot specified invoice payload. - shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the - user. - order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. - telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. - provider_payment_charge_id (:obj:`str`): Provider payment identifier. - Args: currency (:obj:`str`): Three-letter ISO 4217 currency code. total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not @@ -60,6 +50,16 @@ class SuccessfulPayment(TelegramObject): provider_payment_charge_id (:obj:`str`): Provider payment identifier. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + currency (:obj:`str`): Three-letter ISO 4217 currency code. + total_amount (:obj:`int`): Total price in the smallest units of the currency. + invoice_payload (:obj:`str`): Bot specified invoice payload. + shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the + user. + order_info (:class:`telegram.OrderInfo`): Optional. Order info provided by the user. + telegram_payment_charge_id (:obj:`str`): Telegram payment identifier. + provider_payment_charge_id (:obj:`str`): Provider payment identifier. + """ def __init__( diff --git a/telegram/poll.py b/telegram/poll.py index ae2bfa318..c35d3192f 100644 --- a/telegram/poll.py +++ b/telegram/poll.py @@ -38,11 +38,11 @@ class PollOption(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`text` and :attr:`voter_count` are equal. - Attributes: + Args: text (:obj:`str`): Option text, 1-100 characters. voter_count (:obj:`int`): Number of users that voted for this option. - Args: + Attributes: text (:obj:`str`): Option text, 1-100 characters. voter_count (:obj:`int`): Number of users that voted for this option. diff --git a/telegram/proximityalerttriggered.py b/telegram/proximityalerttriggered.py index bfab7a2d9..a99fb86d8 100644 --- a/telegram/proximityalerttriggered.py +++ b/telegram/proximityalerttriggered.py @@ -34,15 +34,16 @@ class ProximityAlertTriggered(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`traveler`, :attr:`watcher` and :attr:`distance` are equal. + Args: + traveler (:class:`telegram.User`): User that triggered the alert + watcher (:class:`telegram.User`): User that set the alert + distance (:obj:`int`): The distance between the users + Attributes: traveler (:class:`telegram.User`): User that triggered the alert watcher (:class:`telegram.User`): User that set the alert distance (:obj:`int`): The distance between the users - Args: - traveler (:class:`telegram.User`): User that triggered the alert - watcher (:class:`telegram.User`): User that set the alert - distance (:obj:`int`): The distance between the users """ def __init__(self, traveler: User, watcher: User, distance: int, **_kwargs: Any): diff --git a/telegram/replykeyboardmarkup.py b/telegram/replykeyboardmarkup.py index 27c729d27..333c998f4 100644 --- a/telegram/replykeyboardmarkup.py +++ b/telegram/replykeyboardmarkup.py @@ -30,13 +30,6 @@ class ReplyKeyboardMarkup(ReplyMarkup): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their the size of :attr:`keyboard` and all the buttons are equal. - Attributes: - keyboard (List[List[:class:`telegram.KeyboardButton` | :obj:`str`]]): Array of button rows. - resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard. - one_time_keyboard (:obj:`bool`): Optional. Requests clients to hide the keyboard as soon as - it's been used. - selective (:obj:`bool`): Optional. Show the keyboard to specific users only. - Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. @@ -63,6 +56,13 @@ class ReplyKeyboardMarkup(ReplyMarkup): **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + keyboard (List[List[:class:`telegram.KeyboardButton` | :obj:`str`]]): Array of button rows. + resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard. + one_time_keyboard (:obj:`bool`): Optional. Requests clients to hide the keyboard as soon as + it's been used. + selective (:obj:`bool`): Optional. Show the keyboard to specific users only. + """ def __init__( diff --git a/telegram/replykeyboardremove.py b/telegram/replykeyboardremove.py index f218fdb33..047f184cb 100644 --- a/telegram/replykeyboardremove.py +++ b/telegram/replykeyboardremove.py @@ -29,16 +29,15 @@ class ReplyKeyboardRemove(ReplyMarkup): until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see :class:`telegram.ReplyKeyboardMarkup`). - Attributes: - remove_keyboard (:obj:`True`): Requests clients to remove the custom keyboard. - selective (:obj:`bool`): Optional. Use this parameter if you want to remove the keyboard - for specific users only. - Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. + Note: + User will not be able to summon this keyboard; if you want to hide the keyboard from + sight but keep it accessible, use :attr:`telegram.ReplyKeyboardMarkup.one_time_keyboard`. + Args: selective (:obj:`bool`, optional): Use this parameter if you want to remove the keyboard for specific users only. Targets: @@ -49,9 +48,10 @@ class ReplyKeyboardRemove(ReplyMarkup): **kwargs (:obj:`dict`): Arbitrary keyword arguments. - Note: - User will not be able to summon this keyboard; if you want to hide the keyboard from - sight but keep it accessible, use :attr:`telegram.ReplyKeyboardMarkup.one_time_keyboard`. + Attributes: + remove_keyboard (:obj:`True`): Requests clients to remove the custom keyboard. + selective (:obj:`bool`): Optional. Use this parameter if you want to remove the keyboard + for specific users only. """ diff --git a/telegram/update.py b/telegram/update.py index 9dffd018c..3cb5278d4 100644 --- a/telegram/update.py +++ b/telegram/update.py @@ -46,25 +46,6 @@ class Update(TelegramObject): Note: At most one of the optional parameters can be present in any given update. - Attributes: - update_id (:obj:`int`): The update's unique identifier. - message (:class:`telegram.Message`): Optional. New incoming message. - edited_message (:class:`telegram.Message`): Optional. New version of a message. - channel_post (:class:`telegram.Message`): Optional. New incoming channel post. - edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post. - inline_query (:class:`telegram.InlineQuery`): Optional. New incoming inline query. - chosen_inline_result (:class:`telegram.ChosenInlineResult`): Optional. The result of an - inline query that was chosen by a user. - callback_query (:class:`telegram.CallbackQuery`): Optional. New incoming callback query. - shipping_query (:class:`telegram.ShippingQuery`): Optional. New incoming shipping query. - pre_checkout_query (:class:`telegram.PreCheckoutQuery`): Optional. New incoming - pre-checkout query. - poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates - about stopped polls and polls, which are sent by the bot. - poll_answer (:class:`telegram.PollAnswer`): Optional. A user changed their answer - in a non-anonymous poll. Bots receive new votes only in polls that were sent - by the bot itself. - Args: update_id (:obj:`int`): The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if @@ -95,6 +76,25 @@ class Update(TelegramObject): by the bot itself. **kwargs (:obj:`dict`): Arbitrary keyword arguments. + Attributes: + update_id (:obj:`int`): The update's unique identifier. + message (:class:`telegram.Message`): Optional. New incoming message. + edited_message (:class:`telegram.Message`): Optional. New version of a message. + channel_post (:class:`telegram.Message`): Optional. New incoming channel post. + edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post. + inline_query (:class:`telegram.InlineQuery`): Optional. New incoming inline query. + chosen_inline_result (:class:`telegram.ChosenInlineResult`): Optional. The result of an + inline query that was chosen by a user. + callback_query (:class:`telegram.CallbackQuery`): Optional. New incoming callback query. + shipping_query (:class:`telegram.ShippingQuery`): Optional. New incoming shipping query. + pre_checkout_query (:class:`telegram.PreCheckoutQuery`): Optional. New incoming + pre-checkout query. + poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates + about stopped polls and polls, which are sent by the bot. + poll_answer (:class:`telegram.PollAnswer`): Optional. A user changed their answer + in a non-anonymous poll. Bots receive new votes only in polls that were sent + by the bot itself. + """ def __init__( diff --git a/telegram/user.py b/telegram/user.py index 4de1a7b7f..cc55cc64d 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -60,21 +60,6 @@ class User(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. - Attributes: - id (:obj:`int`): Unique identifier for this user or bot. - is_bot (:obj:`bool`): :obj:`True`, if this user is a bot. - first_name (:obj:`str`): User's or bots first name. - last_name (:obj:`str`): Optional. User's or bots last name. - username (:obj:`str`): Optional. User's or bots username. - language_code (:obj:`str`): Optional. IETF language tag of the user's language. - can_join_groups (:obj:`str`): Optional. :obj:`True`, if the bot can be invited to groups. - Returned only in :attr:`telegram.Bot.get_me` requests. - can_read_all_group_messages (:obj:`str`): Optional. :obj:`True`, if privacy mode is - disabled for the bot. Returned only in :attr:`telegram.Bot.get_me` requests. - supports_inline_queries (:obj:`str`): Optional. :obj:`True`, if the bot supports inline - queries. Returned only in :attr:`telegram.Bot.get_me` requests. - bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. - Args: id (:obj:`int`): Unique identifier for this user or bot. is_bot (:obj:`bool`): :obj:`True`, if this user is a bot. @@ -90,6 +75,21 @@ class User(TelegramObject): queries. Returned only in :attr:`telegram.Bot.get_me` requests. bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. + Attributes: + id (:obj:`int`): Unique identifier for this user or bot. + is_bot (:obj:`bool`): :obj:`True`, if this user is a bot. + first_name (:obj:`str`): User's or bot's first name. + last_name (:obj:`str`): Optional. User's or bot's last name. + username (:obj:`str`): Optional. User's or bot's username. + language_code (:obj:`str`): Optional. IETF language tag of the user's language. + can_join_groups (:obj:`str`): Optional. :obj:`True`, if the bot can be invited to groups. + Returned only in :attr:`telegram.Bot.get_me` requests. + can_read_all_group_messages (:obj:`str`): Optional. :obj:`True`, if privacy mode is + disabled for the bot. Returned only in :attr:`telegram.Bot.get_me` requests. + supports_inline_queries (:obj:`str`): Optional. :obj:`True`, if the bot supports inline + queries. Returned only in :attr:`telegram.Bot.get_me` requests. + bot (:class:`telegram.Bot`): Optional. The Bot to use for instance methods. + """ def __init__( diff --git a/telegram/userprofilephotos.py b/telegram/userprofilephotos.py index 29aed261d..77b0234b3 100644 --- a/telegram/userprofilephotos.py +++ b/telegram/userprofilephotos.py @@ -33,15 +33,15 @@ class UserProfilePhotos(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`total_count` and :attr:`photos` are equal. - Attributes: - total_count (:obj:`int`): Total number of profile pictures. - photos (List[List[:class:`telegram.PhotoSize`]]): Requested profile pictures. - Args: total_count (:obj:`int`): Total number of profile pictures the target user has. photos (List[List[:class:`telegram.PhotoSize`]]): Requested profile pictures (in up to 4 sizes each). + Attributes: + total_count (:obj:`int`): Total number of profile pictures. + photos (List[List[:class:`telegram.PhotoSize`]]): Requested profile pictures. + """ def __init__(self, total_count: int, photos: List[List[PhotoSize]], **_kwargs: Any): diff --git a/telegram/utils/helpers.py b/telegram/utils/helpers.py index 3da37d916..89d1020e7 100644 --- a/telegram/utils/helpers.py +++ b/telegram/utils/helpers.py @@ -511,11 +511,12 @@ class DefaultValue: if value: ... + Args: + value (:obj:`obj`): The value of the default argument + Attributes: value (:obj:`obj`): The value of the default argument - Args: - value (:obj:`obj`): The value of the default argument """ def __init__(self, value: Any = None): diff --git a/telegram/webhookinfo.py b/telegram/webhookinfo.py index dcfa6ae75..df4c51ce0 100644 --- a/telegram/webhookinfo.py +++ b/telegram/webhookinfo.py @@ -33,18 +33,6 @@ class WebhookInfo(TelegramObject): :attr:`pending_update_count`, :attr:`ip_address`, :attr:`last_error_date`, :attr:`last_error_message`, :attr:`max_connections` and :attr:`allowed_updates` are equal. - Attributes: - url (:obj:`str`): Webhook URL. - has_custom_certificate (:obj:`bool`): If a custom certificate was provided for webhook. - pending_update_count (:obj:`int`): Number of updates awaiting delivery. - ip_address (:obj:`str`): Optional. Currently used webhook IP address. - last_error_date (:obj:`int`): Optional. Unix time for the most recent error that happened. - last_error_message (:obj:`str`): Optional. Error message in human-readable format. - max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS - connections. - allowed_updates (List[:obj:`str`]): Optional. A list of update types the bot is subscribed - to. - Args: url (:obj:`str`): Webhook URL, may be empty if webhook is not set up. has_custom_certificate (:obj:`bool`): :obj:`True`, if a custom certificate was provided for @@ -60,6 +48,18 @@ class WebhookInfo(TelegramObject): allowed_updates (List[:obj:`str`], optional): A list of update types the bot is subscribed to. Defaults to all update types. + Attributes: + url (:obj:`str`): Webhook URL. + has_custom_certificate (:obj:`bool`): If a custom certificate was provided for webhook. + pending_update_count (:obj:`int`): Number of updates awaiting delivery. + ip_address (:obj:`str`): Optional. Currently used webhook IP address. + last_error_date (:obj:`int`): Optional. Unix time for the most recent error that happened. + last_error_message (:obj:`str`): Optional. Error message in human-readable format. + max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS + connections. + allowed_updates (List[:obj:`str`]): Optional. A list of update types the bot is subscribed + to. + """ def __init__(