diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 6be16ba5..992548fd 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -328,15 +328,16 @@ def start(): ) if docstring_args: - docstring_args = "Args:\n " + "\n ".join(docstring_args) + docstring_args = "Parameters:\n " + "\n ".join(docstring_args) else: docstring_args = "No parameters required." docstring_args = "Attributes:\n ID: ``{}``\n\n ".format(c.id) + docstring_args if c.section == "functions": - docstring_args += "\n\n Raises:\n :obj:`RPCError `" docstring_args += "\n\n Returns:\n " + get_docstring_arg_type(c.return_type) + docstring_args += "\n\n Raises:\n RPCError: In case of a Telegram RPC error." + else: references = get_references(".".join(filter(None, [c.namespace, c.name]))) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8acfde42..e08298ef 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -44,6 +44,8 @@ extensions = [ 'sphinx.ext.autosummary' ] +napoleon_use_rtype = False + # Don't show source files on docs html_show_sourcelink = True @@ -112,7 +114,7 @@ html_theme = 'sphinx_rtd_theme' # html_theme_options = { 'canonical_url': "https://docs.pyrogram.ml/", - 'collapse_navigation': False, + 'collapse_navigation': True, 'sticky_navigation': False, 'logo_only': True, 'display_version': True diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst deleted file mode 100644 index 5adf4956..00000000 --- a/docs/source/pyrogram/Client.rst +++ /dev/null @@ -1,162 +0,0 @@ -Client -====== - -.. currentmodule:: pyrogram.Client - -.. autoclass:: pyrogram.Client - -Utilities ---------- - -.. autosummary:: - :nosignatures: - - start - stop - restart - idle - run - add_handler - remove_handler - send - resolve_peer - save_file - stop_transmission - -Decorators ----------- - -.. autosummary:: - :nosignatures: - - on_message - on_callback_query - on_inline_query - on_deleted_messages - on_user_status - on_disconnect - on_raw_update - -Messages --------- - -.. autosummary:: - :nosignatures: - - send_message - forward_messages - send_photo - send_audio - send_document - send_sticker - send_video - send_animation - send_voice - send_video_note - send_media_group - send_location - send_venue - send_contact - send_cached_media - send_chat_action - edit_message_text - edit_message_caption - edit_message_reply_markup - edit_message_media - delete_messages - get_messages - get_history - get_history_count - iter_history - send_poll - vote_poll - stop_poll - retract_vote - download_media - -Chats ------ - -.. autosummary:: - :nosignatures: - - join_chat - leave_chat - kick_chat_member - unban_chat_member - restrict_chat_member - promote_chat_member - export_chat_invite_link - set_chat_photo - delete_chat_photo - set_chat_title - set_chat_description - pin_chat_message - unpin_chat_message - get_chat - get_chat_preview - get_chat_member - get_chat_members - get_chat_members_count - iter_chat_members - get_dialogs - iter_dialogs - get_dialogs_count - restrict_chat - update_chat_username - -Users ------ - -.. autosummary:: - :nosignatures: - - get_me - get_users - get_user_profile_photos - get_user_profile_photos_count - set_user_profile_photo - delete_user_profile_photos - update_username - -Contacts --------- - -.. autosummary:: - :nosignatures: - - add_contacts - get_contacts - get_contacts_count - delete_contacts - -Password --------- - -.. autosummary:: - :nosignatures: - - enable_cloud_password - change_cloud_password - remove_cloud_password - -Bots ----- - -.. autosummary:: - :nosignatures: - - get_inline_bot_results - send_inline_bot_result - answer_callback_query - answer_inline_query - request_callback_answer - send_game - set_game_score - get_game_high_scores - answer_inline_query - - -.. autoclass:: pyrogram.Client - :inherited-members: - :members: diff --git a/docs/source/pyrogram/Decorators.rst b/docs/source/pyrogram/Decorators.rst new file mode 100644 index 00000000..a9cd70c7 --- /dev/null +++ b/docs/source/pyrogram/Decorators.rst @@ -0,0 +1,47 @@ +Decorators +========== + +While still being methods bound to the :obj:`Client` class, decorators are of a special kind and thus deserve a +dedicated page. + +Decorators are able to register callback functions for handling updates in a much easier and cleaner way compared to +`Handlers `_; they do so by instantiating the correct handler and calling +:meth:`add_handler() `, automatically. All you need to do is adding the decorators on top +of your functions. + +**Example:** + +.. code-block:: python + + from pyrogram import Client + + app = Client(...) + + + @app.on_message() + def log(client, message): + print(message) + + + app.run() + +.. currentmodule:: pyrogram.Client + +.. autosummary:: + :nosignatures: + + on_message + on_callback_query + on_inline_query + on_deleted_messages + on_user_status + on_disconnect + on_raw_update + +.. automethod:: pyrogram.Client.on_message() +.. automethod:: pyrogram.Client.on_callback_query() +.. automethod:: pyrogram.Client.on_inline_query() +.. automethod:: pyrogram.Client.on_deleted_messages() +.. automethod:: pyrogram.Client.on_user_status() +.. automethod:: pyrogram.Client.on_disconnect() +.. automethod:: pyrogram.Client.on_raw_update() \ No newline at end of file diff --git a/docs/source/pyrogram/Errors.rst b/docs/source/pyrogram/Errors.rst new file mode 100644 index 00000000..6c816a72 --- /dev/null +++ b/docs/source/pyrogram/Errors.rst @@ -0,0 +1,28 @@ +Errors +====== + +All the Pyrogram errors listed here live inside the ``errors`` sub-package. + +**Example:** + +.. code-block:: python + + from pyrogram.errors import RPCError + + try: + ... + except RPCError: + ... + +.. autoexception:: pyrogram.RPCError() + :members: + +.. toctree:: + ../errors/SeeOther + ../errors/BadRequest + ../errors/Unauthorized + ../errors/Forbidden + ../errors/NotAcceptable + ../errors/Flood + ../errors/InternalServerError + ../errors/UnknownError diff --git a/docs/source/pyrogram/Handlers.rst b/docs/source/pyrogram/Handlers.rst index 1bb16ece..7140897b 100644 --- a/docs/source/pyrogram/Handlers.rst +++ b/docs/source/pyrogram/Handlers.rst @@ -1,6 +1,29 @@ Handlers ======== +Handlers are used to instruct Pyrogram about which kind of updates you'd like to handle with your callback functions. + +For a much more convenient way of registering callback functions have a look at `Decorators `_ instead. +In case you decided to manually create an handler, use :meth:`add_handler() ` to register +it. + +**Example:** + +.. code-block:: python + + from pyrogram import Client, MessageHandler + + app = Client(...) + + + def dump(client, message): + print(message) + + + app.add_handler(MessageHandler(dump)) + + app.run() + .. currentmodule:: pyrogram .. autosummary:: @@ -14,24 +37,24 @@ Handlers DisconnectHandler RawUpdateHandler -.. autoclass:: MessageHandler +.. autoclass:: MessageHandler() :members: -.. autoclass:: DeletedMessagesHandler +.. autoclass:: DeletedMessagesHandler() :members: -.. autoclass:: CallbackQueryHandler +.. autoclass:: CallbackQueryHandler() :members: -.. autoclass:: InlineQueryHandler +.. autoclass:: InlineQueryHandler() :members: -.. autoclass:: UserStatusHandler +.. autoclass:: UserStatusHandler() :members: -.. autoclass:: DisconnectHandler +.. autoclass:: DisconnectHandler() :members: -.. autoclass:: RawUpdateHandler +.. autoclass:: RawUpdateHandler() :members: diff --git a/docs/source/pyrogram/Methods.rst b/docs/source/pyrogram/Methods.rst new file mode 100644 index 00000000..d0387790 --- /dev/null +++ b/docs/source/pyrogram/Methods.rst @@ -0,0 +1,270 @@ +Methods +======= + +All Pyrogram methods listed here are bound to a :obj:`Client ` instance. + +**Example:** + +.. code-block:: python + + from pyrogram import Client + + app = Client(...) + + with app: + app.send_message("haskell", "hi") + +.. currentmodule:: pyrogram.Client + +Utilities +--------- + +.. autosummary:: + :nosignatures: + + start + stop + restart + idle + run + add_handler + remove_handler + send + resolve_peer + save_file + stop_transmission + +Messages +-------- + +.. autosummary:: + :nosignatures: + + send_message + forward_messages + send_photo + send_audio + send_document + send_sticker + send_video + send_animation + send_voice + send_video_note + send_media_group + send_location + send_venue + send_contact + send_cached_media + send_chat_action + edit_message_text + edit_message_caption + edit_message_reply_markup + edit_message_media + delete_messages + get_messages + get_history + get_history_count + iter_history + send_poll + vote_poll + stop_poll + retract_vote + download_media + +Chats +----- + +.. autosummary:: + :nosignatures: + + join_chat + leave_chat + kick_chat_member + unban_chat_member + restrict_chat_member + promote_chat_member + export_chat_invite_link + set_chat_photo + delete_chat_photo + set_chat_title + set_chat_description + pin_chat_message + unpin_chat_message + get_chat + get_chat_preview + get_chat_member + get_chat_members + get_chat_members_count + iter_chat_members + get_dialogs + iter_dialogs + get_dialogs_count + restrict_chat + update_chat_username + +Users +----- + +.. autosummary:: + :nosignatures: + + get_me + get_users + get_user_profile_photos + get_user_profile_photos_count + set_user_profile_photo + delete_user_profile_photos + update_username + +Contacts +-------- + +.. autosummary:: + :nosignatures: + + add_contacts + get_contacts + get_contacts_count + delete_contacts + +Password +-------- + +.. autosummary:: + :nosignatures: + + enable_cloud_password + change_cloud_password + remove_cloud_password + +Bots +---- + +.. autosummary:: + :nosignatures: + + get_inline_bot_results + send_inline_bot_result + answer_callback_query + answer_inline_query + request_callback_answer + send_game + set_game_score + get_game_high_scores + answer_inline_query + +.. Utilities + --------- + +.. automethod:: pyrogram.Client.start() +.. automethod:: pyrogram.Client.stop() +.. automethod:: pyrogram.Client.restart() +.. automethod:: pyrogram.Client.idle() +.. automethod:: pyrogram.Client.run() +.. automethod:: pyrogram.Client.add_handler() +.. automethod:: pyrogram.Client.remove_handler() +.. automethod:: pyrogram.Client.send() +.. automethod:: pyrogram.Client.resolve_peer() +.. automethod:: pyrogram.Client.save_file() +.. automethod:: pyrogram.Client.stop_transmission() + +.. Messages + -------- + +.. automethod:: pyrogram.Client.send_message() +.. automethod:: pyrogram.Client.forward_messages() +.. automethod:: pyrogram.Client.send_photo() +.. automethod:: pyrogram.Client.send_audio() +.. automethod:: pyrogram.Client.send_document() +.. automethod:: pyrogram.Client.send_sticker() +.. automethod:: pyrogram.Client.send_video() +.. automethod:: pyrogram.Client.send_animation() +.. automethod:: pyrogram.Client.send_voice() +.. automethod:: pyrogram.Client.send_video_note() +.. automethod:: pyrogram.Client.send_media_group() +.. automethod:: pyrogram.Client.send_location() +.. automethod:: pyrogram.Client.send_venue() +.. automethod:: pyrogram.Client.send_contact() +.. automethod:: pyrogram.Client.send_cached_media() +.. automethod:: pyrogram.Client.send_chat_action() +.. automethod:: pyrogram.Client.edit_message_text() +.. automethod:: pyrogram.Client.edit_message_caption() +.. automethod:: pyrogram.Client.edit_message_reply_markup() +.. automethod:: pyrogram.Client.edit_message_media() +.. automethod:: pyrogram.Client.delete_messages() +.. automethod:: pyrogram.Client.get_messages() +.. automethod:: pyrogram.Client.get_history() +.. automethod:: pyrogram.Client.get_history_count() +.. automethod:: pyrogram.Client.iter_history() +.. automethod:: pyrogram.Client.send_poll() +.. automethod:: pyrogram.Client.vote_poll() +.. automethod:: pyrogram.Client.stop_poll() +.. automethod:: pyrogram.Client.retract_vote() +.. automethod:: pyrogram.Client.download_media() + +.. Chats + ----- + +.. automethod:: pyrogram.Client.join_chat() +.. automethod:: pyrogram.Client.leave_chat() +.. automethod:: pyrogram.Client.kick_chat_member() +.. automethod:: pyrogram.Client.unban_chat_member() +.. automethod:: pyrogram.Client.restrict_chat_member() +.. automethod:: pyrogram.Client.promote_chat_member() +.. automethod:: pyrogram.Client.export_chat_invite_link() +.. automethod:: pyrogram.Client.set_chat_photo() +.. automethod:: pyrogram.Client.delete_chat_photo() +.. automethod:: pyrogram.Client.set_chat_title() +.. automethod:: pyrogram.Client.set_chat_description() +.. automethod:: pyrogram.Client.pin_chat_message() +.. automethod:: pyrogram.Client.unpin_chat_message() +.. automethod:: pyrogram.Client.get_chat() +.. automethod:: pyrogram.Client.get_chat_preview() +.. automethod:: pyrogram.Client.get_chat_member() +.. automethod:: pyrogram.Client.get_chat_members() +.. automethod:: pyrogram.Client.get_chat_members_count() +.. automethod:: pyrogram.Client.iter_chat_members() +.. automethod:: pyrogram.Client.get_dialogs() +.. automethod:: pyrogram.Client.iter_dialogs() +.. automethod:: pyrogram.Client.get_dialogs_count() +.. automethod:: pyrogram.Client.restrict_chat() +.. automethod:: pyrogram.Client.update_chat_username() + +.. Users + ----- + +.. automethod:: pyrogram.Client.get_me() +.. automethod:: pyrogram.Client.get_users() +.. automethod:: pyrogram.Client.get_user_profile_photos() +.. automethod:: pyrogram.Client.get_user_profile_photos_count() +.. automethod:: pyrogram.Client.set_user_profile_photo() +.. automethod:: pyrogram.Client.delete_user_profile_photos() +.. automethod:: pyrogram.Client.update_username() + +.. Contacts + -------- + +.. automethod:: pyrogram.Client.add_contacts() +.. automethod:: pyrogram.Client.get_contacts() +.. automethod:: pyrogram.Client.get_contacts_count() +.. automethod:: pyrogram.Client.delete_contacts() + +.. Password + -------- + +.. automethod:: pyrogram.Client.enable_cloud_password() +.. automethod:: pyrogram.Client.change_cloud_password() +.. automethod:: pyrogram.Client.remove_cloud_password() + +.. Bots + ---- + +.. automethod:: pyrogram.Client.get_inline_bot_results() +.. automethod:: pyrogram.Client.send_inline_bot_result() +.. automethod:: pyrogram.Client.answer_callback_query() +.. automethod:: pyrogram.Client.answer_inline_query() +.. automethod:: pyrogram.Client.request_callback_answer() +.. automethod:: pyrogram.Client.send_game() +.. automethod:: pyrogram.Client.set_game_score() +.. automethod:: pyrogram.Client.get_game_high_scores() +.. automethod:: pyrogram.Client.answer_inline_query() \ No newline at end of file diff --git a/docs/source/pyrogram/ParseMode.rst b/docs/source/pyrogram/ParseMode.rst deleted file mode 100644 index 6a4e0bbb..00000000 --- a/docs/source/pyrogram/ParseMode.rst +++ /dev/null @@ -1,6 +0,0 @@ -ParseMode -========= - -.. autoclass:: pyrogram.ParseMode - :members: - :undoc-members: diff --git a/docs/source/pyrogram/RPCError.rst b/docs/source/pyrogram/RPCError.rst deleted file mode 100644 index a47c9b9c..00000000 --- a/docs/source/pyrogram/RPCError.rst +++ /dev/null @@ -1,15 +0,0 @@ -RPCError -======== - -.. autoexception:: pyrogram.RPCError - :members: - -.. toctree:: - ../errors/SeeOther - ../errors/BadRequest - ../errors/Unauthorized - ../errors/Forbidden - ../errors/NotAcceptable - ../errors/Flood - ../errors/InternalServerError - ../errors/UnknownError diff --git a/docs/source/pyrogram/Types.rst b/docs/source/pyrogram/Types.rst index 5deb58b2..52e97107 100644 --- a/docs/source/pyrogram/Types.rst +++ b/docs/source/pyrogram/Types.rst @@ -1,6 +1,19 @@ Types ===== +All Pyrogram types listed here are accessible through the main package directly. + +**Example:** + +.. code-block:: python + + from pyrogram import User, Message, ... + +.. note:: + + **Optional** fields may not exist when irrelevant -- i.e.: they will contain the value of ``None`` and aren't shown + when, for example, using ``print()``. + .. currentmodule:: pyrogram Users & Chats @@ -42,11 +55,12 @@ Messages & Media Location Venue Sticker + Game Poll PollOption -Bots ----- +Keyboards +--------- .. autosummary:: :nosignatures: @@ -58,7 +72,8 @@ Bots InlineKeyboardButton ForceReply CallbackQuery - Game + GameHighScore + CallbackGame Input Media ----------- @@ -96,168 +111,168 @@ InputMessageContent .. User & Chats ------------ -.. autoclass:: User +.. autoclass:: User() :members: -.. autoclass:: UserStatus +.. autoclass:: UserStatus() :members: -.. autoclass:: Chat +.. autoclass:: Chat() :members: -.. autoclass:: ChatPreview +.. autoclass:: ChatPreview() :members: -.. autoclass:: ChatPhoto +.. autoclass:: ChatPhoto() :members: -.. autoclass:: ChatMember +.. autoclass:: ChatMember() :members: -.. autoclass:: ChatMembers +.. autoclass:: ChatMembers() :members: -.. autoclass:: ChatPermissions +.. autoclass:: ChatPermissions() :members: -.. autoclass:: Dialog +.. autoclass:: Dialog() :members: -.. autoclass:: Dialogs +.. autoclass:: Dialogs() :members: .. Messages & Media ---------------- -.. autoclass:: Message +.. autoclass:: Message() :members: -.. autoclass:: Messages +.. autoclass:: Messages() :members: -.. autoclass:: MessageEntity +.. autoclass:: MessageEntity() :members: -.. autoclass:: Photo +.. autoclass:: Photo() :members: -.. autoclass:: PhotoSize +.. autoclass:: PhotoSize() :members: -.. autoclass:: UserProfilePhotos +.. autoclass:: UserProfilePhotos() :members: -.. autoclass:: Audio +.. autoclass:: Audio() :members: -.. autoclass:: Document +.. autoclass:: Document() :members: -.. autoclass:: Animation +.. autoclass:: Animation() :members: -.. autoclass:: Video +.. autoclass:: Video() :members: -.. autoclass:: Voice +.. autoclass:: Voice() :members: -.. autoclass:: VideoNote +.. autoclass:: VideoNote() :members: -.. autoclass:: Contact +.. autoclass:: Contact() :members: -.. autoclass:: Location +.. autoclass:: Location() :members: -.. autoclass:: Venue +.. autoclass:: Venue() :members: -.. autoclass:: Sticker +.. autoclass:: Sticker() :members: -.. autoclass:: Poll +.. autoclass:: Game() :members: -.. autoclass:: PollOption +.. autoclass:: Poll() :members: -.. Bots - ---- - -.. autoclass:: ReplyKeyboardMarkup +.. autoclass:: PollOption() :members: -.. autoclass:: KeyboardButton +.. Keyboards + --------- + +.. autoclass:: ReplyKeyboardMarkup() :members: -.. autoclass:: ReplyKeyboardRemove +.. autoclass:: KeyboardButton() :members: -.. autoclass:: InlineKeyboardMarkup +.. autoclass:: ReplyKeyboardRemove() :members: -.. autoclass:: InlineKeyboardButton +.. autoclass:: InlineKeyboardMarkup() :members: -.. autoclass:: ForceReply +.. autoclass:: InlineKeyboardButton() :members: -.. autoclass:: CallbackQuery +.. autoclass:: ForceReply() :members: -.. autoclass:: Game +.. autoclass:: CallbackQuery() :members: -.. autoclass:: GameHighScore +.. autoclass:: GameHighScore() :members: -.. autoclass:: GameHighScores +.. autoclass:: CallbackGame() :members: .. Input Media ----------- -.. autoclass:: InputMedia +.. autoclass:: InputMedia() :members: -.. autoclass:: InputMediaPhoto +.. autoclass:: InputMediaPhoto() :members: -.. autoclass:: InputMediaVideo +.. autoclass:: InputMediaVideo() :members: -.. autoclass:: InputMediaAudio +.. autoclass:: InputMediaAudio() :members: -.. autoclass:: InputMediaAnimation +.. autoclass:: InputMediaAnimation() :members: -.. autoclass:: InputMediaDocument +.. autoclass:: InputMediaDocument() :members: -.. autoclass:: InputPhoneContact +.. autoclass:: InputPhoneContact() :members: .. Inline Mode ----------- -.. autoclass:: InlineQuery +.. autoclass:: InlineQuery() :members: -.. autoclass:: InlineQueryResult +.. autoclass:: InlineQueryResult() :members: -.. autoclass:: InlineQueryResultArticle +.. autoclass:: InlineQueryResultArticle() :members: .. InputMessageContent ------------------- -.. autoclass:: InputMessageContent +.. autoclass:: InputMessageContent() :members: -.. autoclass:: InputTextMessageContent +.. autoclass:: InputTextMessageContent() :members: diff --git a/docs/source/pyrogram/index.rst b/docs/source/pyrogram/index.rst index 286b5db1..84471e89 100644 --- a/docs/source/pyrogram/index.rst +++ b/docs/source/pyrogram/index.rst @@ -4,17 +4,18 @@ Pyrogram In this section you can find a detailed description of the Pyrogram package and its API. :class:`Client ` is the main class. It exposes easy-to-use methods that are named -after the well established `Telegram Bot API`_ methods, thus offering a familiar look to Bot developers. +after the well established Telegram Bot API methods, thus offering a familiar look to Bot developers. .. toctree:: :maxdepth: 1 - Client Types + Methods Handlers + Decorators Filters ChatAction - ParseMode - RPCError + Errors -.. _Telegram Bot API: https://core.telegram.org/bots/api#available-methods + +.. autoclass:: pyrogram.Client() diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 610a0d0c..823faf27 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -64,7 +64,7 @@ class Client(Methods, BaseClient): It exposes bot-like methods for an easy access to the API as well as a simple way to invoke every single Telegram API method available. - Args: + Parameters: session_name (``str``): Name to uniquely identify a session of either a User or a Bot, e.g.: "my_account". This name will be used to save a file to disk that stores details needed for reconnecting without asking again for credentials. @@ -264,8 +264,8 @@ class Client(Methods, BaseClient): """Use this method to start the Client. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ConnectionError`` in case you try to start an already started Client. + RPCError: In case of a Telegram RPC error. + ConnectionError: In case you try to start an already started Client. """ if self.is_started: raise ConnectionError("Client has already been started") @@ -357,7 +357,7 @@ class Client(Methods, BaseClient): """Use this method to stop the Client. Raises: - ``ConnectionError`` in case you try to stop an already stopped Client. + ConnectionError: In case you try to stop an already stopped Client. """ if not self.is_started: raise ConnectionError("Client is already stopped") @@ -399,7 +399,7 @@ class Client(Methods, BaseClient): """Use this method to restart the Client. Raises: - ``ConnectionError`` in case you try to restart a stopped Client. + ConnectionError: In case you try to restart a stopped Client. """ self.stop() self.start() @@ -416,7 +416,7 @@ class Client(Methods, BaseClient): the main script; calling idle() will ensure the client(s) will be kept alive by not letting the main script to end, until you decide to quit. - Args: + Parameters: stop_signals (``tuple``, *optional*): Iterable containing signals the signal handler will listen to. Defaults to (SIGINT, SIGTERM, SIGABRT). @@ -445,7 +445,7 @@ class Client(Methods, BaseClient): since :meth:`idle` will block. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ self.start() self.idle() @@ -457,7 +457,7 @@ class Client(Methods, BaseClient): will be used for a single update. To handle the same update more than once, register your handler using a different group id (lower group id == higher priority). - Args: + Parameters: handler (``Handler``): The handler to be registered. @@ -465,7 +465,7 @@ class Client(Methods, BaseClient): The group identifier, defaults to 0. Returns: - A tuple of (handler, group) + ``tuple``: A tuple consisting of (handler, group). """ if isinstance(handler, DisconnectHandler): self.disconnect_handler = handler.callback @@ -481,7 +481,7 @@ class Client(Methods, BaseClient): the return value of the :meth:`add_handler` method, a tuple of (handler, group), and pass it directly. - Args: + Parameters: handler (``Handler``): The handler to be removed. @@ -1048,8 +1048,8 @@ class Client(Methods, BaseClient): :obj:`functions ` (i.e: a Telegram API method you wish to use which is not available yet in the Client class as an easy-to-use method). - Args: - data (``Object``): + Parameters: + data (``RawFunction``): The API Schema function filled with proper arguments. retries (``int``): @@ -1058,8 +1058,11 @@ class Client(Methods, BaseClient): timeout (``float``): Timeout in seconds. + Returns: + ``RawType``: The raw type response generated by the query. + Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if not self.is_started: raise ConnectionError("Client has not been started") @@ -1347,17 +1350,17 @@ class Client(Methods, BaseClient): :obj:`functions ` (i.e: a Telegram API method you wish to use which is not available yet in the Client class as an easy-to-use method). - Args: + Parameters: peer_id (``int`` | ``str``): The peer id you want to extract the InputPeer from. Can be a direct id (int), a username (str) or a phone number (str). Returns: - On success, the resolved peer id is returned in form of an InputPeer object. + ``InputPeer``: On success, the resolved peer id is returned in form of an InputPeer object. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``KeyError`` in case the peer doesn't exist in the internal database. + RPCError: In case of a Telegram RPC error. + KeyError: In case the peer doesn't exist in the internal database. """ try: return self.peers_by_id[peer_id] @@ -1429,7 +1432,7 @@ class Client(Methods, BaseClient): :obj:`functions ` (i.e: a Telegram API method you wish to use which is not available yet in the Client class as an easy-to-use method). - Args: + Parameters: path (``str``): The path of the file you want to upload that exists on your local machine. @@ -1449,7 +1452,7 @@ class Client(Methods, BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -1463,10 +1466,10 @@ class Client(Methods, BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the uploaded file is returned in form of an InputFile object. + ``InputFile``: On success, the uploaded file is returned in form of an InputFile object. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ part_size = 512 * 1024 file_size = os.path.getsize(path) diff --git a/pyrogram/client/filters/filters.py b/pyrogram/client/filters/filters.py index 8f5b9164..5070bd52 100644 --- a/pyrogram/client/filters/filters.py +++ b/pyrogram/client/filters/filters.py @@ -27,7 +27,7 @@ def create(name: str, func: callable, **kwargs) -> type: Custom filters give you extra control over which updates are allowed or not to be processed by your handlers. - Args: + Parameters: name (``str``): Your filter's name. Can be anything you like. @@ -35,9 +35,9 @@ def create(name: str, func: callable, **kwargs) -> type: A function that accepts two arguments *(filter, update)* and returns a Boolean: True if the update should be handled, False otherwise. The "update" argument type will vary depending on which `Handler `_ is coming from. - For example, in a :obj:`MessageHandler ` the update type will be - a :obj:`Message `; in a :obj:`CallbackQueryHandler ` the - update type will be a :obj:`CallbackQuery `. Your function body can then access the + For example, in a :obj:`MessageHandler` the update type will be + a :obj:`Message`; in a :obj:`CallbackQueryHandler` the + update type will be a :obj:`CallbackQuery`. Your function body can then access the incoming update and decide whether to allow it or not. **kwargs (``any``, *optional*): @@ -54,7 +54,7 @@ def create(name: str, func: callable, **kwargs) -> type: class Filters: """This class provides access to all library-defined Filters available in Pyrogram. - The Filters listed here are intended to be used with the :obj:`MessageHandler ` only. + The Filters listed here are intended to be used with the :obj:`MessageHandler` only. At the moment, if you want to filter updates coming from different `Handlers `_ you have to create your own filters with :meth:`Filters.create` and use them in the same way. """ @@ -89,49 +89,49 @@ class Filters: """Filter edited messages.""" audio = create("Audio", lambda _, m: bool(m.audio)) - """Filter messages that contain :obj:`Audio ` objects.""" + """Filter messages that contain :obj:`Audio` objects.""" document = create("Document", lambda _, m: bool(m.document)) - """Filter messages that contain :obj:`Document ` objects.""" + """Filter messages that contain :obj:`Document` objects.""" photo = create("Photo", lambda _, m: bool(m.photo)) - """Filter messages that contain :obj:`Photo ` objects.""" + """Filter messages that contain :obj:`Photo` objects.""" sticker = create("Sticker", lambda _, m: bool(m.sticker)) - """Filter messages that contain :obj:`Sticker ` objects.""" + """Filter messages that contain :obj:`Sticker` objects.""" animation = create("Animation", lambda _, m: bool(m.animation)) - """Filter messages that contain :obj:`Animation ` objects.""" + """Filter messages that contain :obj:`Animation` objects.""" game = create("Game", lambda _, m: bool(m.game)) - """Filter messages that contain :obj:`Game ` objects.""" + """Filter messages that contain :obj:`Game` objects.""" video = create("Video", lambda _, m: bool(m.video)) - """Filter messages that contain :obj:`Video ` objects.""" + """Filter messages that contain :obj:`Video` objects.""" media_group = create("MediaGroup", lambda _, m: bool(m.media_group_id)) """Filter messages containing photos or videos being part of an album.""" voice = create("Voice", lambda _, m: bool(m.voice)) - """Filter messages that contain :obj:`Voice ` note objects.""" + """Filter messages that contain :obj:`Voice` note objects.""" video_note = create("VideoNote", lambda _, m: bool(m.video_note)) - """Filter messages that contain :obj:`VideoNote ` objects.""" + """Filter messages that contain :obj:`VideoNote` objects.""" contact = create("Contact", lambda _, m: bool(m.contact)) - """Filter messages that contain :obj:`Contact ` objects.""" + """Filter messages that contain :obj:`Contact` objects.""" location = create("Location", lambda _, m: bool(m.location)) - """Filter messages that contain :obj:`Location ` objects.""" + """Filter messages that contain :obj:`Location` objects.""" venue = create("Venue", lambda _, m: bool(m.venue)) - """Filter messages that contain :obj:`Venue ` objects.""" + """Filter messages that contain :obj:`Venue` objects.""" web_page = create("WebPage", lambda _, m: m.web_page) """Filter messages sent with a webpage preview.""" poll = create("Poll", lambda _, m: m.poll) - """Filter messages that contain :obj:`Poll ` objects.""" + """Filter messages that contain :obj:`Poll` objects.""" private = create("Private", lambda _, m: bool(m.chat and m.chat.type == "private")) """Filter messages sent in private chats.""" @@ -230,12 +230,12 @@ class Filters: ): """Filter commands, i.e.: text messages starting with "/" or any other custom prefix. - Args: + Parameters: commands (``str`` | ``list``): The command or list of commands as string the filter should look for. Examples: "start", ["start", "help", "settings"]. When a message text containing a command arrives, the command itself and its arguments will be stored in the *command* - field of the :class:`Message `. + field of the :class:`Message`. prefix (``str`` | ``list``, *optional*): A prefix or a list of prefixes as string the filter should look for. @@ -275,11 +275,11 @@ class Filters: def regex(pattern, flags: int = 0): """Filter messages that match a given RegEx pattern. - Args: + Parameters: pattern (``str``): The RegEx pattern as string, it will be applied to the text of a message. When a pattern matches, all the `Match Objects `_ - are stored in the *matches* field of the :class:`Message ` itself. + are stored in the *matches* field of the :class:`Message` itself. flags (``int``, *optional*): RegEx flags. @@ -298,7 +298,7 @@ class Filters: You can use `set bound methods `_ to manipulate the users container. - Args: + Parameters: users (``int`` | ``str`` | ``list``): Pass one or more user ids/usernames to filter users. For you yourself, "me" or "self" can be used as well. @@ -329,7 +329,7 @@ class Filters: You can use `set bound methods `_ to manipulate the chats container. - Args: + Parameters: chats (``int`` | ``str`` | ``list``): Pass one or more chat ids/usernames to filter chats. For your personal cloud (Saved Messages) you can simply use "me" or "self". diff --git a/pyrogram/client/handlers/callback_query_handler.py b/pyrogram/client/handlers/callback_query_handler.py index 88ddd5a0..feb46cb0 100644 --- a/pyrogram/client/handlers/callback_query_handler.py +++ b/pyrogram/client/handlers/callback_query_handler.py @@ -26,17 +26,17 @@ class CallbackQueryHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_callback_query() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a new CallbackQuery arrives. It takes *(client, callback_query)* as positional arguments (look at the section below for a detailed description). - filters (:obj:`Filters `): + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of callback queries to be passed in your callback function. Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the message handler. callback_query (:obj:`CallbackQuery `): diff --git a/pyrogram/client/handlers/deleted_messages_handler.py b/pyrogram/client/handlers/deleted_messages_handler.py index 52177dcc..f37caaed 100644 --- a/pyrogram/client/handlers/deleted_messages_handler.py +++ b/pyrogram/client/handlers/deleted_messages_handler.py @@ -27,20 +27,20 @@ class DeletedMessagesHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_deleted_messages() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when one or more Messages have been deleted. It takes *(client, messages)* as positional arguments (look at the section below for a detailed description). - filters (:obj:`Filters `): + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of messages to be passed in your callback function. Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the message handler. - messages (:obj:`Messages `): + messages (:obj:`Messages`): The deleted messages. """ diff --git a/pyrogram/client/handlers/disconnect_handler.py b/pyrogram/client/handlers/disconnect_handler.py index 1e88a7ee..b9e6350a 100644 --- a/pyrogram/client/handlers/disconnect_handler.py +++ b/pyrogram/client/handlers/disconnect_handler.py @@ -26,13 +26,13 @@ class DisconnectHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_disconnect() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a disconnection occurs. It takes *(client)* as positional argument (look at the section below for a detailed description). Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself. Useful, for example, when you want to change the proxy before a new connection is established. """ diff --git a/pyrogram/client/handlers/inline_query_handler.py b/pyrogram/client/handlers/inline_query_handler.py index c64d49c8..98a25652 100644 --- a/pyrogram/client/handlers/inline_query_handler.py +++ b/pyrogram/client/handlers/inline_query_handler.py @@ -26,20 +26,20 @@ class InlineQueryHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_inline_query() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a new InlineQuery arrives. It takes *(client, inline_query)* as positional arguments (look at the section below for a detailed description). - filters (:obj:`Filters `): + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of inline queries to be passed in your callback function. Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the inline query handler. - inline_query (:obj:`InlineQuery `): + inline_query (:obj:`InlineQuery`): The received inline query. """ diff --git a/pyrogram/client/handlers/message_handler.py b/pyrogram/client/handlers/message_handler.py index 67b4587e..10fff479 100644 --- a/pyrogram/client/handlers/message_handler.py +++ b/pyrogram/client/handlers/message_handler.py @@ -27,20 +27,20 @@ class MessageHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_message() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a new Message arrives. It takes *(client, message)* as positional arguments (look at the section below for a detailed description). - filters (:obj:`Filters `): + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of messages to be passed in your callback function. Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the message handler. - message (:obj:`Message `): + message (:obj:`Message`): The received message. """ diff --git a/pyrogram/client/handlers/poll_handler.py b/pyrogram/client/handlers/poll_handler.py index 567fcec0..9e97f2ac 100644 --- a/pyrogram/client/handlers/poll_handler.py +++ b/pyrogram/client/handlers/poll_handler.py @@ -27,7 +27,7 @@ class PollHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_poll() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a new poll update arrives. It takes *(client, poll)* as positional arguments (look at the section below for a detailed description). diff --git a/pyrogram/client/handlers/raw_update_handler.py b/pyrogram/client/handlers/raw_update_handler.py index 3a5dea50..f54d59b6 100644 --- a/pyrogram/client/handlers/raw_update_handler.py +++ b/pyrogram/client/handlers/raw_update_handler.py @@ -26,14 +26,14 @@ class RawUpdateHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_raw_update() ` decorator. - Args: + Parameters: callback (``callable``): A function that will be called when a new update is received from the server. It takes *(client, update, users, chats)* as positional arguments (look at the section below for a detailed description). Other Parameters: - client (:class:`Client `): + client (:class:`Client`): The Client itself, useful when you want to call other API methods inside the update handler. update (``Update``): diff --git a/pyrogram/client/handlers/user_status_handler.py b/pyrogram/client/handlers/user_status_handler.py index 856ef81d..1250cb19 100644 --- a/pyrogram/client/handlers/user_status_handler.py +++ b/pyrogram/client/handlers/user_status_handler.py @@ -26,20 +26,20 @@ class UserStatusHandler(Handler): For a nicer way to register this handler, have a look at the :meth:`on_user_status() ` decorator. - Args: + Parameters: callback (``callable``): Pass a function that will be called when a new UserStatus update arrives. It takes *(client, user_status)* as positional arguments (look at the section below for a detailed description). - filters (:obj:`Filters `): + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of messages to be passed in your callback function. Other parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the user status handler. - user_status (:obj:`UserStatus `): + user_status (:obj:`UserStatus`): The received UserStatus update. """ diff --git a/pyrogram/client/methods/bots/answer_callback_query.py b/pyrogram/client/methods/bots/answer_callback_query.py index 33458db9..12effe47 100644 --- a/pyrogram/client/methods/bots/answer_callback_query.py +++ b/pyrogram/client/methods/bots/answer_callback_query.py @@ -32,7 +32,7 @@ class AnswerCallbackQuery(BaseClient): """Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. - Args: + Parameters: callback_query_id (``str``): Unique identifier for the query to be answered. @@ -54,10 +54,10 @@ class AnswerCallbackQuery(BaseClient): Telegram apps will support caching starting in version 3.14. Defaults to 0. Returns: - True, on success. + ``bool``: True, on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self.send( functions.messages.SetBotCallbackAnswer( diff --git a/pyrogram/client/methods/bots/answer_inline_query.py b/pyrogram/client/methods/bots/answer_inline_query.py index 7b3524b2..7a1b14c8 100644 --- a/pyrogram/client/methods/bots/answer_inline_query.py +++ b/pyrogram/client/methods/bots/answer_inline_query.py @@ -37,7 +37,7 @@ class AnswerInlineQuery(BaseClient): """Use this method to send answers to an inline query. No more than 50 results per query are allowed. - Args: + Parameters: inline_query_id (``str``): Unique identifier for the answered query. @@ -73,7 +73,10 @@ class AnswerInlineQuery(BaseClient): where they wanted to use the bot's inline capabilities. Returns: - On success, True is returned. + ``bool``: On success, True is returned. + + Raises: + RPCError: In case of a Telegram RPC error. """ return self.send( functions.messages.SetInlineBotResults( diff --git a/pyrogram/client/methods/bots/get_game_high_scores.py b/pyrogram/client/methods/bots/get_game_high_scores.py index bb2e99db..64901fea 100644 --- a/pyrogram/client/methods/bots/get_game_high_scores.py +++ b/pyrogram/client/methods/bots/get_game_high_scores.py @@ -29,10 +29,10 @@ class GetGameHighScores(BaseClient): user_id: Union[int, str], chat_id: Union[int, str], message_id: int = None - ): + ) -> "pyrogram.GameHighScores": """Use this method to get data for high score tables. - Args: + Parameters: user_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -49,10 +49,10 @@ class GetGameHighScores(BaseClient): Required if inline_message_id is not specified. Returns: - On success, a :obj:`GameHighScores ` object is returned. + :obj:`GameHighScores`: On success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ # TODO: inline_message_id diff --git a/pyrogram/client/methods/bots/get_inline_bot_results.py b/pyrogram/client/methods/bots/get_inline_bot_results.py index b12c0439..14628b64 100644 --- a/pyrogram/client/methods/bots/get_inline_bot_results.py +++ b/pyrogram/client/methods/bots/get_inline_bot_results.py @@ -35,7 +35,7 @@ class GetInlineBotResults(BaseClient): """Use this method to get bot results via inline queries. You can then send a result using :obj:`send_inline_bot_result ` - Args: + Parameters: bot (``int`` | ``str``): Unique identifier of the inline bot you want to get results from. You can specify a @username (str) or a bot ID (int). @@ -55,11 +55,11 @@ class GetInlineBotResults(BaseClient): Useful for location-based results only. Returns: - On Success, :obj:`BotResults ` is returned. + :obj:`BotResults `: On Success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``TimeoutError`` if the bot fails to answer within 10 seconds + RPCError: In case of a Telegram RPC error. + TimeoutError: In case the bot fails to answer within 10 seconds. """ # TODO: Don't return the raw type diff --git a/pyrogram/client/methods/bots/request_callback_answer.py b/pyrogram/client/methods/bots/request_callback_answer.py index 7b37f51a..b1d8884f 100644 --- a/pyrogram/client/methods/bots/request_callback_answer.py +++ b/pyrogram/client/methods/bots/request_callback_answer.py @@ -32,7 +32,7 @@ class RequestCallbackAnswer(BaseClient): """Use this method to request a callback answer from bots. This is the equivalent of clicking an inline button containing callback data. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -49,8 +49,8 @@ class RequestCallbackAnswer(BaseClient): or as an alert. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``TimeoutError`` if the bot fails to answer within 10 seconds. + RPCError: In case of a Telegram RPC error. + TimeoutError: In case the bot fails to answer within 10 seconds. """ return self.send( functions.messages.GetBotCallbackAnswer( diff --git a/pyrogram/client/methods/bots/send_game.py b/pyrogram/client/methods/bots/send_game.py index a690c960..03593a56 100644 --- a/pyrogram/client/methods/bots/send_game.py +++ b/pyrogram/client/methods/bots/send_game.py @@ -39,7 +39,7 @@ class SendGame(BaseClient): ) -> "pyrogram.Message": """Use this method to send a game. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -60,10 +60,10 @@ class SendGame(BaseClient): If not empty, the first button must launch the game. Returns: - On success, the sent :obj:`Message` is returned. + :obj:`Message`: On success, the sent game message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/bots/send_inline_bot_result.py b/pyrogram/client/methods/bots/send_inline_bot_result.py index 9b375a0a..49dc11ee 100644 --- a/pyrogram/client/methods/bots/send_inline_bot_result.py +++ b/pyrogram/client/methods/bots/send_inline_bot_result.py @@ -35,7 +35,7 @@ class SendInlineBotResult(BaseClient): """Use this method to send an inline bot result. Bot results can be retrieved using :obj:`get_inline_bot_results ` - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -61,7 +61,7 @@ class SendInlineBotResult(BaseClient): On success, the sent Message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self.send( functions.messages.SendInlineBotResult( diff --git a/pyrogram/client/methods/bots/set_game_score.py b/pyrogram/client/methods/bots/set_game_score.py index 434720c6..f5658542 100644 --- a/pyrogram/client/methods/bots/set_game_score.py +++ b/pyrogram/client/methods/bots/set_game_score.py @@ -36,7 +36,7 @@ class SetGameScore(BaseClient): # inline_message_id: str = None): TODO Add inline_message_id """Use this method to set the score of the specified user in a game. - Args: + Parameters: user_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -63,12 +63,11 @@ class SetGameScore(BaseClient): Required if inline_message_id is not specified. Returns: - On success, if the message was sent by the bot, returns the edited :obj:`Message `, + On success, if the message was sent by the bot, returns the edited :obj:`Message`, otherwise returns True. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - :class:`BotScoreNotModified` if the new score is not greater than the user's current score in the chat and force is False. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SetGameScore( diff --git a/pyrogram/client/methods/chats/delete_chat_photo.py b/pyrogram/client/methods/chats/delete_chat_photo.py index c11a0d13..f45a7dc2 100644 --- a/pyrogram/client/methods/chats/delete_chat_photo.py +++ b/pyrogram/client/methods/chats/delete_chat_photo.py @@ -35,15 +35,15 @@ class DeleteChatPhoto(BaseClient): In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is off. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/export_chat_invite_link.py b/pyrogram/client/methods/chats/export_chat_invite_link.py index 16f5bc01..e1ca27c2 100644 --- a/pyrogram/client/methods/chats/export_chat_invite_link.py +++ b/pyrogram/client/methods/chats/export_chat_invite_link.py @@ -38,16 +38,16 @@ class ExportChatInviteLink(BaseClient): using this method – after this the link will become available to the bot via the :meth:`get_chat` method. If your bot needs to generate a new invite link replacing its previous one, use this method again. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier for the target chat or username of the target channel/supergroup (in the format @username). Returns: - On success, the exported invite link as string is returned. + ``str``: On success, the exported invite link is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat.py b/pyrogram/client/methods/chats/get_chat.py index 38653459..bf4c4cea 100644 --- a/pyrogram/client/methods/chats/get_chat.py +++ b/pyrogram/client/methods/chats/get_chat.py @@ -32,18 +32,18 @@ class GetChat(BaseClient): Information include current name of the user for one-on-one conversations, current username of a user, group or channel, etc. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. Unique identifier for the target chat in form of a *t.me/joinchat/* link, identifier (int) or username of the target channel/supergroup (in the format @username). Returns: - On success, a :obj:`Chat ` object is returned. + :obj:`Chat`: On success, a chat object is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` in case the chat invite link refers to a chat you haven't joined yet. + RPCError: In case of a Telegram RPC error. + ValueError: In case the chat invite link points to a chat you haven't joined yet. """ match = self.INVITE_LINK_RE.match(str(chat_id)) diff --git a/pyrogram/client/methods/chats/get_chat_member.py b/pyrogram/client/methods/chats/get_chat_member.py index aec4d233..b625e32f 100644 --- a/pyrogram/client/methods/chats/get_chat_member.py +++ b/pyrogram/client/methods/chats/get_chat_member.py @@ -32,7 +32,7 @@ class GetChatMember(BaseClient): ) -> "pyrogram.ChatMember": """Use this method to get information about one member of a chat. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -42,10 +42,10 @@ class GetChatMember(BaseClient): For a contact that exists in your Telegram address book you can use his phone number (str). Returns: - On success, a :obj:`ChatMember ` object is returned. + :obj:`ChatMember`: On success, a chat member is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ chat_id = self.resolve_peer(chat_id) user_id = self.resolve_peer(user_id) diff --git a/pyrogram/client/methods/chats/get_chat_members.py b/pyrogram/client/methods/chats/get_chat_members.py index 726fd14b..79001614 100644 --- a/pyrogram/client/methods/chats/get_chat_members.py +++ b/pyrogram/client/methods/chats/get_chat_members.py @@ -53,7 +53,7 @@ class GetChatMembers(BaseClient): You must be admin to retrieve the members list of a channel (also known as "subscribers"). For a more convenient way of getting chat members see :meth:`iter_chat_members`. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -86,11 +86,11 @@ class GetChatMembers(BaseClient): .. [2] A query string is applicable only for *"all"*, *"kicked"* and *"restricted"* filters only. Returns: - On success, a :obj:`ChatMembers` object is returned. + :obj:`ChatMembers`: On success, an object containing a list of chat members is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` if you used an invalid filter or a chat_id that belongs to a user. + RPCError: In case of a Telegram RPC error. + ValueError: In case you used an invalid filter or a chat id that belongs to a user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat_members_count.py b/pyrogram/client/methods/chats/get_chat_members_count.py index fc13ac39..d40585f5 100644 --- a/pyrogram/client/methods/chats/get_chat_members_count.py +++ b/pyrogram/client/methods/chats/get_chat_members_count.py @@ -29,7 +29,7 @@ class GetChatMembersCount(BaseClient): ) -> int: """Use this method to get the number of members in a chat. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -37,8 +37,8 @@ class GetChatMembersCount(BaseClient): On success, an integer is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` if a chat_id belongs to user. + RPCError: In case of a Telegram RPC error. + ValueError: In case a chat id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/get_chat_preview.py b/pyrogram/client/methods/chats/get_chat_preview.py index 9b6c6955..fd00c374 100644 --- a/pyrogram/client/methods/chats/get_chat_preview.py +++ b/pyrogram/client/methods/chats/get_chat_preview.py @@ -30,16 +30,18 @@ class GetChatPreview(BaseClient): This method only returns a chat preview, if you want to join a chat use :meth:`join_chat` - Args: + Parameters: invite_link (``str``): Unique identifier for the target chat in form of *t.me/joinchat/* links. Returns: - Either :obj:`Chat` or :obj:`ChatPreview`, depending on whether you already joined the chat or not. + :obj:`Chat`: In case you already joined the chat. + + :obj:`ChatPreview` -- In case you haven't joined the chat yet. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` in case of an invalid invite_link. + RPCError: In case of a Telegram RPC error. + ValueError: In case of an invalid invite link. """ match = self.INVITE_LINK_RE.match(invite_link) diff --git a/pyrogram/client/methods/chats/get_dialogs.py b/pyrogram/client/methods/chats/get_dialogs.py index 3bcf223f..83732d07 100644 --- a/pyrogram/client/methods/chats/get_dialogs.py +++ b/pyrogram/client/methods/chats/get_dialogs.py @@ -39,7 +39,7 @@ class GetDialogs(BaseClient): You can get up to 100 dialogs at once. For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`. - Args: + Parameters: offset_date (``int``): The offset date in Unix time taken from the top message of a :obj:`Dialog`. Defaults to 0. Valid for non-pinned dialogs only. @@ -53,10 +53,10 @@ class GetDialogs(BaseClient): Defaults to False. Returns: - On success, a :obj:`Dialogs` object is returned. + :obj:`Dialogs`: On success, an object containing a list of dialogs is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ while True: diff --git a/pyrogram/client/methods/chats/get_dialogs_count.py b/pyrogram/client/methods/chats/get_dialogs_count.py index bf1754ee..eea327da 100644 --- a/pyrogram/client/methods/chats/get_dialogs_count.py +++ b/pyrogram/client/methods/chats/get_dialogs_count.py @@ -29,10 +29,10 @@ class GetDialogsCount(BaseClient): Defaults to False. Returns: - On success, an integer is returned. + ``int``: On success, an integer is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if pinned_only: diff --git a/pyrogram/client/methods/chats/iter_chat_members.py b/pyrogram/client/methods/chats/iter_chat_members.py index 2f41763e..f735da48 100644 --- a/pyrogram/client/methods/chats/iter_chat_members.py +++ b/pyrogram/client/methods/chats/iter_chat_members.py @@ -51,7 +51,7 @@ class IterChatMembers(BaseClient): from the hassle of setting up boilerplate code. It is useful for getting the whole members list of a chat with a single call. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -75,10 +75,10 @@ class IterChatMembers(BaseClient): Defaults to *"all"*. Returns: - A generator yielding :obj:`ChatMember ` objects. + ``Generator``: A generator yielding :obj:`ChatMember` objects. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ current = 0 yielded = set() diff --git a/pyrogram/client/methods/chats/iter_dialogs.py b/pyrogram/client/methods/chats/iter_dialogs.py index 99437cb4..6fc9f81c 100644 --- a/pyrogram/client/methods/chats/iter_dialogs.py +++ b/pyrogram/client/methods/chats/iter_dialogs.py @@ -33,7 +33,7 @@ class IterDialogs(BaseClient): This convenience method does the same as repeatedly calling :meth:`get_dialogs` in a loop, thus saving you from the hassle of setting up boilerplate code. It is useful for getting the whole dialogs list with a single call. - Args: + Parameters: offset_date (``int``): The offset date in Unix time taken from the top message of a :obj:`Dialog`. Defaults to 0 (most recent dialog). @@ -43,10 +43,10 @@ class IterDialogs(BaseClient): By default, no limit is applied and all dialogs are returned. Returns: - A generator yielding :obj:`Dialog ` objects. + ``Generator``: A generator yielding :obj:`Dialog` objects. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ current = 0 total = limit or (1 << 31) - 1 diff --git a/pyrogram/client/methods/chats/join_chat.py b/pyrogram/client/methods/chats/join_chat.py index a7933bea..77b2ee50 100644 --- a/pyrogram/client/methods/chats/join_chat.py +++ b/pyrogram/client/methods/chats/join_chat.py @@ -28,16 +28,16 @@ class JoinChat(BaseClient): ): """Use this method to join a group chat or channel. - Args: + Parameters: chat_id (``str``): Unique identifier for the target chat in form of a *t.me/joinchat/* link or username of the target channel/supergroup (in the format @username). Returns: - On success, a :obj:`Chat ` object is returned. + :obj:`Chat`: On success, a chat object is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ match = self.INVITE_LINK_RE.match(chat_id) diff --git a/pyrogram/client/methods/chats/kick_chat_member.py b/pyrogram/client/methods/chats/kick_chat_member.py index 7b10ddea..dbd095ad 100644 --- a/pyrogram/client/methods/chats/kick_chat_member.py +++ b/pyrogram/client/methods/chats/kick_chat_member.py @@ -40,7 +40,7 @@ class KickChatMember(BaseClient): off in the target group. Otherwise members may only be removed by the group's creator or by the member that added them. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -54,10 +54,12 @@ class KickChatMember(BaseClient): considered to be banned forever. Defaults to 0 (ban forever). Returns: - On success, either True or a service :obj:`Message ` will be returned (when applicable). + :obj:`Message`: On success, a service message will be returned (when applicable). + + ``bool`` -- True, in case a message object couldn't be returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ chat_peer = self.resolve_peer(chat_id) user_peer = self.resolve_peer(user_id) diff --git a/pyrogram/client/methods/chats/leave_chat.py b/pyrogram/client/methods/chats/leave_chat.py index 8ba3a3d1..57cc1090 100644 --- a/pyrogram/client/methods/chats/leave_chat.py +++ b/pyrogram/client/methods/chats/leave_chat.py @@ -30,7 +30,7 @@ class LeaveChat(BaseClient): ): """Use this method to leave a group chat or channel. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier for the target chat or username of the target channel/supergroup (in the format @username). @@ -39,7 +39,7 @@ class LeaveChat(BaseClient): Deletes the group chat dialog after leaving (for simple group chats, not supergroups). Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/pin_chat_message.py b/pyrogram/client/methods/chats/pin_chat_message.py index 1d5466ba..2c485dab 100644 --- a/pyrogram/client/methods/chats/pin_chat_message.py +++ b/pyrogram/client/methods/chats/pin_chat_message.py @@ -33,7 +33,7 @@ class PinChatMessage(BaseClient): You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in the supergroup or "can_edit_messages" admin right in the channel. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -45,10 +45,10 @@ class PinChatMessage(BaseClient): message. Notifications are always disabled in channels. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ self.send( functions.messages.UpdatePinnedMessage( diff --git a/pyrogram/client/methods/chats/promote_chat_member.py b/pyrogram/client/methods/chats/promote_chat_member.py index 26d49516..0b93576a 100644 --- a/pyrogram/client/methods/chats/promote_chat_member.py +++ b/pyrogram/client/methods/chats/promote_chat_member.py @@ -41,7 +41,7 @@ class PromoteChatMember(BaseClient): You must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -76,10 +76,10 @@ class PromoteChatMember(BaseClient): were appointed by him). Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ self.send( functions.channels.EditAdmin( diff --git a/pyrogram/client/methods/chats/restrict_chat.py b/pyrogram/client/methods/chats/restrict_chat.py index 40d46d34..9f6d2910 100644 --- a/pyrogram/client/methods/chats/restrict_chat.py +++ b/pyrogram/client/methods/chats/restrict_chat.py @@ -39,7 +39,7 @@ class RestrictChat(BaseClient): """Use this method to restrict a chat. Pass True for all boolean parameters to lift restrictions from a chat. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -70,10 +70,10 @@ class RestrictChat(BaseClient): Pass True, if the user can pin messages. Returns: - On success, a :obj:`Chat ` object is returned. + :obj:`Chat`: On success, a chat object is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ send_messages = True send_media = True diff --git a/pyrogram/client/methods/chats/restrict_chat_member.py b/pyrogram/client/methods/chats/restrict_chat_member.py index 8688ecca..1f31d8eb 100644 --- a/pyrogram/client/methods/chats/restrict_chat_member.py +++ b/pyrogram/client/methods/chats/restrict_chat_member.py @@ -43,7 +43,7 @@ class RestrictChatMember(BaseClient): The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -83,10 +83,10 @@ class RestrictChatMember(BaseClient): Pass True, if the user can pin messages. Returns: - On success, a :obj:`Chat ` object is returned. + :obj:`Chat`: On success, a chat object is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ send_messages = True send_media = True diff --git a/pyrogram/client/methods/chats/set_chat_description.py b/pyrogram/client/methods/chats/set_chat_description.py index 9d4e130b..6cc3bbd3 100644 --- a/pyrogram/client/methods/chats/set_chat_description.py +++ b/pyrogram/client/methods/chats/set_chat_description.py @@ -31,7 +31,7 @@ class SetChatDescription(BaseClient): """Use this method to change the description of a supergroup or a channel. You must be an administrator in the chat for this to work and must have the appropriate admin rights. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -39,10 +39,10 @@ class SetChatDescription(BaseClient): New chat description, 0-255 characters. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. ``ValueError`` if a chat_id doesn't belong to a supergroup or a channel. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/set_chat_photo.py b/pyrogram/client/methods/chats/set_chat_photo.py index 87fe1b72..7248a265 100644 --- a/pyrogram/client/methods/chats/set_chat_photo.py +++ b/pyrogram/client/methods/chats/set_chat_photo.py @@ -39,7 +39,7 @@ class SetChatPhoto(BaseClient): In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is off. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -47,10 +47,10 @@ class SetChatPhoto(BaseClient): New chat photo. You can pass a :class:`Photo` id or a file path to upload a new photo. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. ``ValueError`` if a chat_id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/set_chat_title.py b/pyrogram/client/methods/chats/set_chat_title.py index e94f16a8..a159d2cc 100644 --- a/pyrogram/client/methods/chats/set_chat_title.py +++ b/pyrogram/client/methods/chats/set_chat_title.py @@ -36,7 +36,7 @@ class SetChatTitle(BaseClient): In regular groups (non-supergroups), this method will only work if the "All Members Are Admins" setting is off. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -44,11 +44,11 @@ class SetChatTitle(BaseClient): New chat title, 1-255 characters. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` if a chat_id belongs to user. + RPCError: In case of a Telegram RPC error. + ValueError: In case a chat id belongs to user. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/chats/unban_chat_member.py b/pyrogram/client/methods/chats/unban_chat_member.py index 0576c028..35ea0343 100644 --- a/pyrogram/client/methods/chats/unban_chat_member.py +++ b/pyrogram/client/methods/chats/unban_chat_member.py @@ -32,7 +32,7 @@ class UnbanChatMember(BaseClient): The user will **not** return to the group or channel automatically, but will be able to join via link, etc. You must be an administrator for this to work. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. @@ -41,10 +41,10 @@ class UnbanChatMember(BaseClient): For a contact that exists in your Telegram address book you can use his phone number (str). Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ self.send( functions.channels.EditBanned( diff --git a/pyrogram/client/methods/chats/unpin_chat_message.py b/pyrogram/client/methods/chats/unpin_chat_message.py index 9753d656..4e2531fd 100644 --- a/pyrogram/client/methods/chats/unpin_chat_message.py +++ b/pyrogram/client/methods/chats/unpin_chat_message.py @@ -31,15 +31,15 @@ class UnpinChatMessage(BaseClient): You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in the supergroup or "can_edit_messages" admin right in the channel. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ self.send( functions.messages.UpdatePinnedMessage( diff --git a/pyrogram/client/methods/chats/update_chat_username.py b/pyrogram/client/methods/chats/update_chat_username.py index 39cdfaeb..2e8adb05 100644 --- a/pyrogram/client/methods/chats/update_chat_username.py +++ b/pyrogram/client/methods/chats/update_chat_username.py @@ -32,18 +32,18 @@ class UpdateChatUsername(BaseClient): To update your own username (for users only, not bots) you can use :meth:`update_username`. - Args: + Parameters: chat_id (``int`` | ``str``) Unique identifier (int) or username (str) of the target chat. username (``str`` | ``None``): Username to set. Pass "" (empty string) or None to remove the username. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` if a chat_id belongs to a user or chat. + RPCError: In case of a Telegram RPC error. + ValueError: In case a chat id belongs to a user or chat. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/contacts/add_contacts.py b/pyrogram/client/methods/contacts/add_contacts.py index d1a97c99..aa8e1fd5 100644 --- a/pyrogram/client/methods/contacts/add_contacts.py +++ b/pyrogram/client/methods/contacts/add_contacts.py @@ -30,15 +30,12 @@ class AddContacts(BaseClient): ): """Use this method to add contacts to your Telegram address book. - Args: - contacts (List of :obj:`InputPhoneContact `): + Parameters: + contacts (List of :obj:`InputPhoneContact`): The contact list to be added - Returns: - On success, the added contacts are returned. - Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ imported_contacts = self.send( functions.contacts.ImportContacts( diff --git a/pyrogram/client/methods/contacts/delete_contacts.py b/pyrogram/client/methods/contacts/delete_contacts.py index af8f453e..db5b9df1 100644 --- a/pyrogram/client/methods/contacts/delete_contacts.py +++ b/pyrogram/client/methods/contacts/delete_contacts.py @@ -30,16 +30,16 @@ class DeleteContacts(BaseClient): ): """Use this method to delete contacts from your Telegram address book. - Args: + Parameters: ids (List of ``int``): A list of unique identifiers for the target users. Can be an ID (int), a username (string) or phone number (string). Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ contacts = [] diff --git a/pyrogram/client/methods/contacts/get_contacts.py b/pyrogram/client/methods/contacts/get_contacts.py index e62847c8..7e607e77 100644 --- a/pyrogram/client/methods/contacts/get_contacts.py +++ b/pyrogram/client/methods/contacts/get_contacts.py @@ -18,6 +18,7 @@ import logging import time +from typing import List import pyrogram from pyrogram.api import functions @@ -28,14 +29,14 @@ log = logging.getLogger(__name__) class GetContacts(BaseClient): - def get_contacts(self): + def get_contacts(self) -> List["pyrogram.User"]: """Use this method to get contacts from your Telegram address book. Returns: - On success, a list of :obj:`User` objects is returned. + List of :obj:`User`: On success, a list of users is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ while True: try: diff --git a/pyrogram/client/methods/contacts/get_contacts_count.py b/pyrogram/client/methods/contacts/get_contacts_count.py index b41b27b8..b9e6f6c4 100644 --- a/pyrogram/client/methods/contacts/get_contacts_count.py +++ b/pyrogram/client/methods/contacts/get_contacts_count.py @@ -25,10 +25,10 @@ class GetContactsCount(BaseClient): """Use this method to get the total count of contacts from your Telegram address book. Returns: - On success, an integer is returned. + ``int``: On success, an integer is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return len(self.send(functions.contacts.GetContacts(hash=0)).contacts) diff --git a/pyrogram/client/methods/decorators/on_callback_query.py b/pyrogram/client/methods/decorators/on_callback_query.py index 3c747c5f..9ead25b4 100644 --- a/pyrogram/client/methods/decorators/on_callback_query.py +++ b/pyrogram/client/methods/decorators/on_callback_query.py @@ -33,8 +33,8 @@ class OnCallbackQuery(BaseClient): """Use this decorator to automatically register a function for handling callback queries. This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`. - Args: - filters (:obj:`Filters `): + Parameters: + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of callback queries to be passed in your function. diff --git a/pyrogram/client/methods/decorators/on_deleted_messages.py b/pyrogram/client/methods/decorators/on_deleted_messages.py index cf8f9cf2..eb9dfcd0 100644 --- a/pyrogram/client/methods/decorators/on_deleted_messages.py +++ b/pyrogram/client/methods/decorators/on_deleted_messages.py @@ -33,8 +33,8 @@ class OnDeletedMessages(BaseClient): """Use this decorator to automatically register a function for handling deleted messages. This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`. - Args: - filters (:obj:`Filters `): + Parameters: + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of messages to be passed in your function. diff --git a/pyrogram/client/methods/decorators/on_inline_query.py b/pyrogram/client/methods/decorators/on_inline_query.py index 81f0f676..e9758c64 100644 --- a/pyrogram/client/methods/decorators/on_inline_query.py +++ b/pyrogram/client/methods/decorators/on_inline_query.py @@ -33,7 +33,7 @@ class OnInlineQuery(BaseClient): """Use this decorator to automatically register a function for handling inline queries. This does the same thing as :meth:`add_handler` using the :class:`InlineQueryHandler`. - Args: + Parameters: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of inline queries to be passed in your function. diff --git a/pyrogram/client/methods/decorators/on_message.py b/pyrogram/client/methods/decorators/on_message.py index e6563893..ad95cd45 100644 --- a/pyrogram/client/methods/decorators/on_message.py +++ b/pyrogram/client/methods/decorators/on_message.py @@ -33,8 +33,8 @@ class OnMessage(BaseClient): """Use this decorator to automatically register a function for handling messages. This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`. - Args: - filters (:obj:`Filters `): + Parameters: + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of messages to be passed in your function. diff --git a/pyrogram/client/methods/decorators/on_poll.py b/pyrogram/client/methods/decorators/on_poll.py index 56dcd757..68f3d78e 100644 --- a/pyrogram/client/methods/decorators/on_poll.py +++ b/pyrogram/client/methods/decorators/on_poll.py @@ -33,7 +33,7 @@ class OnPoll(BaseClient): """Use this decorator to automatically register a function for handling poll updates. This does the same thing as :meth:`add_handler` using the :class:`PollHandler`. - Args: + Parameters: filters (:obj:`Filters `): Pass one or more filters to allow only a subset of polls to be passed in your function. diff --git a/pyrogram/client/methods/decorators/on_raw_update.py b/pyrogram/client/methods/decorators/on_raw_update.py index 1494a319..2ab1f61b 100644 --- a/pyrogram/client/methods/decorators/on_raw_update.py +++ b/pyrogram/client/methods/decorators/on_raw_update.py @@ -31,7 +31,7 @@ class OnRawUpdate(BaseClient): """Use this decorator to automatically register a function for handling raw updates. This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`. - Args: + Parameters: group (``int``, *optional*): The group identifier, defaults to 0. """ diff --git a/pyrogram/client/methods/decorators/on_user_status.py b/pyrogram/client/methods/decorators/on_user_status.py index 4d8185b1..5b49bb3c 100644 --- a/pyrogram/client/methods/decorators/on_user_status.py +++ b/pyrogram/client/methods/decorators/on_user_status.py @@ -33,8 +33,8 @@ class OnUserStatus(BaseClient): """Use this decorator to automatically register a function for handling user status updates. This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`. - Args: - filters (:obj:`Filters `): + Parameters: + filters (:obj:`Filters`): Pass one or more filters to allow only a subset of UserStatus updated to be passed in your function. group (``int``, *optional*): diff --git a/pyrogram/client/methods/messages/delete_messages.py b/pyrogram/client/methods/messages/delete_messages.py index 4076be22..067d2fae 100644 --- a/pyrogram/client/methods/messages/delete_messages.py +++ b/pyrogram/client/methods/messages/delete_messages.py @@ -31,7 +31,7 @@ class DeleteMessages(BaseClient): ) -> bool: """Use this method to delete messages, including service messages. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -48,10 +48,10 @@ class DeleteMessages(BaseClient): Defaults to True. Returns: - True on success, False otherwise. + ``bool``: True on success, False otherwise. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids] diff --git a/pyrogram/client/methods/messages/download_media.py b/pyrogram/client/methods/messages/download_media.py index 35959d4a..04a5ec57 100644 --- a/pyrogram/client/methods/messages/download_media.py +++ b/pyrogram/client/methods/messages/download_media.py @@ -34,8 +34,8 @@ class DownloadMedia(BaseClient): ) -> Union[str, None]: """Use this method to download the media from a message. - Args: - message (:obj:`Message ` | ``str``): + Parameters: + message (:obj:`Message` | ``str``): Pass a Message containing the media, the media itself (message.audio, message.video, ...) or the file id as string. @@ -59,7 +59,7 @@ class DownloadMedia(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -73,11 +73,12 @@ class DownloadMedia(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the absolute path of the downloaded file as string is returned, None otherwise. - In case the download is deliberately stopped with :meth:`stop_transmission`, None is returned as well. + ``str``: On success, the absolute path of the downloaded file is returned. + + ``None`` -- In case the download is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. ``ValueError`` if the message doesn't contain any downloadable media """ error_message = "This message doesn't contain any downloadable media" diff --git a/pyrogram/client/methods/messages/edit_message_caption.py b/pyrogram/client/methods/messages/edit_message_caption.py index c7bcbd70..fe19dcc9 100644 --- a/pyrogram/client/methods/messages/edit_message_caption.py +++ b/pyrogram/client/methods/messages/edit_message_caption.py @@ -34,7 +34,7 @@ class EditMessageCaption(BaseClient): ) -> "pyrogram.Message": """Use this method to edit captions of messages. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -47,18 +47,17 @@ class EditMessageCaption(BaseClient): New caption of the message. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". reply_markup (:obj:`InlineKeyboardMarkup`, *optional*): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + :obj:`Message`: On success, the edited message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/edit_message_media.py b/pyrogram/client/methods/messages/edit_message_media.py index 69693384..b03fb1e0 100644 --- a/pyrogram/client/methods/messages/edit_message_media.py +++ b/pyrogram/client/methods/messages/edit_message_media.py @@ -47,7 +47,7 @@ class EditMessageMedia(BaseClient): Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -63,10 +63,10 @@ class EditMessageMedia(BaseClient): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + :obj:`Message`: On success, the edited message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ style = self.html if media.parse_mode.lower() == "html" else self.markdown caption = media.caption diff --git a/pyrogram/client/methods/messages/edit_message_reply_markup.py b/pyrogram/client/methods/messages/edit_message_reply_markup.py index e3495476..73561451 100644 --- a/pyrogram/client/methods/messages/edit_message_reply_markup.py +++ b/pyrogram/client/methods/messages/edit_message_reply_markup.py @@ -32,7 +32,7 @@ class EditMessageReplyMarkup(BaseClient): ) -> "pyrogram.Message": """Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -45,11 +45,12 @@ class EditMessageReplyMarkup(BaseClient): An InlineKeyboardMarkup object. Returns: - On success, if edited message is sent by the bot, the edited - :obj:`Message ` is returned, otherwise True is returned. + :obj:`Message`: In case the edited message is sent by the bot. + + ``bool`` -- True, in case the edited message is sent by the user. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( diff --git a/pyrogram/client/methods/messages/edit_message_text.py b/pyrogram/client/methods/messages/edit_message_text.py index 8e23b1de..30b58b68 100644 --- a/pyrogram/client/methods/messages/edit_message_text.py +++ b/pyrogram/client/methods/messages/edit_message_text.py @@ -35,7 +35,7 @@ class EditMessageText(BaseClient): ) -> "pyrogram.Message": """Use this method to edit text messages. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -48,9 +48,8 @@ class EditMessageText(BaseClient): New text of the message. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your message. Defaults to "markdown". disable_web_page_preview (``bool``, *optional*): Disables link previews for links in this message. @@ -59,10 +58,10 @@ class EditMessageText(BaseClient): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + :obj:`Message`: On success, the edited message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/forward_messages.py b/pyrogram/client/methods/messages/forward_messages.py index 5540b38a..08cc48ea 100644 --- a/pyrogram/client/methods/messages/forward_messages.py +++ b/pyrogram/client/methods/messages/forward_messages.py @@ -35,7 +35,7 @@ class ForwardMessages(BaseClient): ) -> "pyrogram.Messages": """Use this method to forward messages of any kind. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -64,13 +64,14 @@ class ForwardMessages(BaseClient): Defaults to False. Returns: - On success and in case *message_ids* was an iterable, the returned value will be a list of the forwarded - :obj:`Messages ` even if a list contains just one element, otherwise if - *message_ids* was an integer, the single forwarded :obj:`Message ` - is returned. + :obj:`Message`: In case *message_ids* was an integer, the single forwarded message is + returned. + + :obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an + object containing a list of messages, even if such iterable contained just a single element. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ is_iterable = not isinstance(message_ids, int) diff --git a/pyrogram/client/methods/messages/get_history.py b/pyrogram/client/methods/messages/get_history.py index 1953fabc..ffd8f9e0 100644 --- a/pyrogram/client/methods/messages/get_history.py +++ b/pyrogram/client/methods/messages/get_history.py @@ -43,7 +43,7 @@ class GetHistory(BaseClient): You can get up to 100 messages at once. For a more convenient way of getting a chat history see :meth:`iter_history`. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -67,10 +67,10 @@ class GetHistory(BaseClient): Pass True to retrieve the messages in reversed order (from older to most recent). Returns: - On success, a :obj:`Messages ` object is returned. + :obj:`Messages` - On success, an object containing a list of the retrieved messages. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ while True: diff --git a/pyrogram/client/methods/messages/get_history_count.py b/pyrogram/client/methods/messages/get_history_count.py index 046ec095..b4812d26 100644 --- a/pyrogram/client/methods/messages/get_history_count.py +++ b/pyrogram/client/methods/messages/get_history_count.py @@ -40,15 +40,15 @@ class GetHistoryCount(BaseClient): a **private** or a **basic group** chat has with a single method call. To overcome this limitation, Pyrogram has to iterate over all the messages. Channels and supergroups are not affected by this limitation. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. Returns: - On success, an integer is returned. + ``int``: On success, an integer is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ peer = self.resolve_peer(chat_id) diff --git a/pyrogram/client/methods/messages/get_messages.py b/pyrogram/client/methods/messages/get_messages.py index f03cac93..391c251c 100644 --- a/pyrogram/client/methods/messages/get_messages.py +++ b/pyrogram/client/methods/messages/get_messages.py @@ -39,7 +39,7 @@ class GetMessages(BaseClient): """Use this method to get one or more messages that belong to a specific chat. You can retrieve up to 200 messages at once. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -60,12 +60,14 @@ class GetMessages(BaseClient): Defaults to 1. Returns: - On success and in case *message_ids* or *reply_to_message_ids* was an iterable, the returned value will be a - :obj:`Messages ` even if a list contains just one element. Otherwise, if *message_ids* or - *reply_to_message_ids* was an integer, the single requested :obj:`Message ` is returned. + :obj:`Message`: In case *message_ids* was an integer, the single forwarded message is + returned. + + :obj:`Messages` -- In case *message_ids* was an iterable, the returned value will be an + object containing a list of messages, even if such iterable contained just a single element. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ ids, ids_type = ( (message_ids, types.InputMessageID) if message_ids diff --git a/pyrogram/client/methods/messages/iter_history.py b/pyrogram/client/methods/messages/iter_history.py index f7a8a74e..b1546318 100644 --- a/pyrogram/client/methods/messages/iter_history.py +++ b/pyrogram/client/methods/messages/iter_history.py @@ -37,7 +37,7 @@ class IterHistory(BaseClient): This convenience method does the same as repeatedly calling :meth:`get_history` in a loop, thus saving you from the hassle of setting up boilerplate code. It is useful for getting the whole chat history with a single call. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -61,10 +61,10 @@ class IterHistory(BaseClient): Pass True to retrieve the messages in reversed order (from older to most recent). Returns: - A generator yielding :obj:`Message ` objects. + ``Generator``: A generator yielding :obj:`Message` objects. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ offset_id = offset_id or (1 if reverse else 0) current = 0 diff --git a/pyrogram/client/methods/messages/retract_vote.py b/pyrogram/client/methods/messages/retract_vote.py index ce8a0140..929298df 100644 --- a/pyrogram/client/methods/messages/retract_vote.py +++ b/pyrogram/client/methods/messages/retract_vote.py @@ -31,7 +31,7 @@ class RetractVote(BaseClient): ) -> "pyrogram.Poll": """Use this method to retract your vote in a poll. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -41,10 +41,10 @@ class RetractVote(BaseClient): Identifier of the original message with the poll. Returns: - On success, the :obj:`Poll ` with the retracted vote is returned. + :obj:`Poll`: On success, the poll with the retracted vote is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendVote( diff --git a/pyrogram/client/methods/messages/send_animation.py b/pyrogram/client/methods/messages/send_animation.py index e2335f72..4e21e56c 100644 --- a/pyrogram/client/methods/messages/send_animation.py +++ b/pyrogram/client/methods/messages/send_animation.py @@ -51,7 +51,7 @@ class SendAnimation(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send animation files (animation or H.264/MPEG-4 AVC video without sound). - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -67,9 +67,8 @@ class SendAnimation(BaseClient): Animation caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of sent animation in seconds. @@ -107,7 +106,7 @@ class SendAnimation(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -121,11 +120,12 @@ class SendAnimation(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent animation message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_audio.py b/pyrogram/client/methods/messages/send_audio.py index 2f01396f..71458c33 100644 --- a/pyrogram/client/methods/messages/send_audio.py +++ b/pyrogram/client/methods/messages/send_audio.py @@ -53,7 +53,7 @@ class SendAudio(BaseClient): For sending voice messages, use the :obj:`send_voice()` method instead. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -69,9 +69,8 @@ class SendAudio(BaseClient): Audio caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of the audio in seconds. @@ -109,7 +108,7 @@ class SendAudio(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -123,11 +122,12 @@ class SendAudio(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent audio message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_cached_media.py b/pyrogram/client/methods/messages/send_cached_media.py index f0c690d9..b0b3fc4e 100644 --- a/pyrogram/client/methods/messages/send_cached_media.py +++ b/pyrogram/client/methods/messages/send_cached_media.py @@ -48,7 +48,7 @@ class SendCachedMedia(BaseClient): It does the same as calling the relevant method for sending media using a file_id, thus saving you from the hassle of using the correct method for the media the file_id is pointing to. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -62,9 +62,8 @@ class SendCachedMedia(BaseClient): Media caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". disable_notification (``bool``, *optional*): Sends the message silently. @@ -78,10 +77,10 @@ class SendCachedMedia(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + :obj:`Message`: On success, the sent media message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_chat_action.py b/pyrogram/client/methods/messages/send_chat_action.py index 04777d42..5c50c2cf 100644 --- a/pyrogram/client/methods/messages/send_chat_action.py +++ b/pyrogram/client/methods/messages/send_chat_action.py @@ -31,15 +31,15 @@ class SendChatAction(BaseClient): ): """Use this method when you need to tell the other party that something is happening on your side. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". For a contact that exists in your Telegram address book you can use his phone number (str). - action (:obj:`ChatAction ` | ``str``): + action (:obj:`ChatAction` | ``str``): Type of action to broadcast. - Choose one from the :class:`ChatAction ` enumeration, + Choose one from the :class:`ChatAction` enumeration, depending on what the user is about to receive. You can also provide a string (e.g. "typing", "upload_photo", "record_audio", ...). @@ -48,11 +48,11 @@ class SendChatAction(BaseClient): Currently useless because official clients don't seem to be handling this. Returns: - On success, True is returned. + ``bool``: On success, True is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` if the provided string is not a valid ChatAction. + RPCError: In case of a Telegram RPC error. + ValueError: In case the provided string is not a valid ChatAction. """ # Resolve Enum type diff --git a/pyrogram/client/methods/messages/send_contact.py b/pyrogram/client/methods/messages/send_contact.py index 9143440e..27df6505 100644 --- a/pyrogram/client/methods/messages/send_contact.py +++ b/pyrogram/client/methods/messages/send_contact.py @@ -42,7 +42,7 @@ class SendContact(BaseClient): ) -> "pyrogram.Message": """Use this method to send phone contacts. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -72,10 +72,10 @@ class SendContact(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + :obj:`Message`: On success, the sent contact message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_document.py b/pyrogram/client/methods/messages/send_document.py index 596adeb1..e2ac0d23 100644 --- a/pyrogram/client/methods/messages/send_document.py +++ b/pyrogram/client/methods/messages/send_document.py @@ -48,7 +48,7 @@ class SendDocument(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send general files. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -70,9 +70,8 @@ class SendDocument(BaseClient): Document caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". disable_notification (``bool``, *optional*): Sends the message silently. @@ -95,7 +94,7 @@ class SendDocument(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -109,11 +108,12 @@ class SendDocument(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent document message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_location.py b/pyrogram/client/methods/messages/send_location.py index f3ed81df..dce6671b 100644 --- a/pyrogram/client/methods/messages/send_location.py +++ b/pyrogram/client/methods/messages/send_location.py @@ -40,7 +40,7 @@ class SendLocation(BaseClient): ) -> "pyrogram.Message": """Use this method to send points on the map. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -64,10 +64,10 @@ class SendLocation(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + :obj:`Message`: On success, the sent location message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_media_group.py b/pyrogram/client/methods/messages/send_media_group.py index f40401b0..fe6725f0 100644 --- a/pyrogram/client/methods/messages/send_media_group.py +++ b/pyrogram/client/methods/messages/send_media_group.py @@ -43,7 +43,7 @@ class SendMediaGroup(BaseClient): ): """Use this method to send a group of photos or videos as an album. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -60,11 +60,10 @@ class SendMediaGroup(BaseClient): If the message is a reply, ID of the original message. Returns: - On success, a :obj:`Messages ` object is returned containing all the - single messages sent. + :obj:`Messages`: On success, an object is returned containing all the single messages sent. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ multi_media = [] diff --git a/pyrogram/client/methods/messages/send_message.py b/pyrogram/client/methods/messages/send_message.py index b45b7192..15c1487a 100644 --- a/pyrogram/client/methods/messages/send_message.py +++ b/pyrogram/client/methods/messages/send_message.py @@ -41,7 +41,7 @@ class SendMessage(BaseClient): ) -> "pyrogram.Message": """Use this method to send text messages. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -51,9 +51,8 @@ class SendMessage(BaseClient): Text of the message to be sent. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your message. Defaults to "markdown". disable_web_page_preview (``bool``, *optional*): Disables link previews for links in this message. @@ -70,10 +69,10 @@ class SendMessage(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message` is returned. + :obj:`Message`: On success, the sent text message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ style = self.html if parse_mode.lower() == "html" else self.markdown message, entities = style.parse(text).values() diff --git a/pyrogram/client/methods/messages/send_photo.py b/pyrogram/client/methods/messages/send_photo.py index 7e327cbd..5487761e 100644 --- a/pyrogram/client/methods/messages/send_photo.py +++ b/pyrogram/client/methods/messages/send_photo.py @@ -48,7 +48,7 @@ class SendPhoto(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send photos. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -64,9 +64,8 @@ class SendPhoto(BaseClient): Photo caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". ttl_seconds (``int``, *optional*): Self-Destruct Timer. @@ -94,7 +93,7 @@ class SendPhoto(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -108,11 +107,12 @@ class SendPhoto(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent photo message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_poll.py b/pyrogram/client/methods/messages/send_poll.py index 6b4e227a..ff5c8533 100644 --- a/pyrogram/client/methods/messages/send_poll.py +++ b/pyrogram/client/methods/messages/send_poll.py @@ -40,7 +40,7 @@ class SendPoll(BaseClient): ) -> "pyrogram.Message": """Use this method to send a new poll. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -64,10 +64,10 @@ class SendPoll(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + :obj:`Message`: On success, the sent poll message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_sticker.py b/pyrogram/client/methods/messages/send_sticker.py index a10f3b74..0e314641 100644 --- a/pyrogram/client/methods/messages/send_sticker.py +++ b/pyrogram/client/methods/messages/send_sticker.py @@ -45,7 +45,7 @@ class SendSticker(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send .webp stickers. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -78,7 +78,7 @@ class SendSticker(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -92,11 +92,12 @@ class SendSticker(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent sticker message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None diff --git a/pyrogram/client/methods/messages/send_venue.py b/pyrogram/client/methods/messages/send_venue.py index 1c9ca630..1045bdbd 100644 --- a/pyrogram/client/methods/messages/send_venue.py +++ b/pyrogram/client/methods/messages/send_venue.py @@ -44,7 +44,7 @@ class SendVenue(BaseClient): ) -> "pyrogram.Message": """Use this method to send information about a venue. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -81,10 +81,10 @@ class SendVenue(BaseClient): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + :obj:`Message`: On success, the sent venue message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( functions.messages.SendMedia( diff --git a/pyrogram/client/methods/messages/send_video.py b/pyrogram/client/methods/messages/send_video.py index 045c1cca..baa91d29 100644 --- a/pyrogram/client/methods/messages/send_video.py +++ b/pyrogram/client/methods/messages/send_video.py @@ -52,7 +52,7 @@ class SendVideo(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send video files. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -68,9 +68,8 @@ class SendVideo(BaseClient): Video caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of sent video in seconds. @@ -111,7 +110,7 @@ class SendVideo(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -125,11 +124,12 @@ class SendVideo(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent video message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/send_video_note.py b/pyrogram/client/methods/messages/send_video_note.py index 464f2711..9f934efe 100644 --- a/pyrogram/client/methods/messages/send_video_note.py +++ b/pyrogram/client/methods/messages/send_video_note.py @@ -48,7 +48,7 @@ class SendVideoNote(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send video messages. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -93,7 +93,7 @@ class SendVideoNote(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -107,11 +107,12 @@ class SendVideoNote(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent video note message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None diff --git a/pyrogram/client/methods/messages/send_voice.py b/pyrogram/client/methods/messages/send_voice.py index 44e998b6..e7ec2b11 100644 --- a/pyrogram/client/methods/messages/send_voice.py +++ b/pyrogram/client/methods/messages/send_voice.py @@ -48,7 +48,7 @@ class SendVoice(BaseClient): ) -> Union["pyrogram.Message", None]: """Use this method to send audio files. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -64,9 +64,8 @@ class SendVoice(BaseClient): Voice message caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of the voice message in seconds. @@ -92,7 +91,7 @@ class SendVoice(BaseClient): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -106,11 +105,12 @@ class SendVoice(BaseClient): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. - In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. + :obj:`Message`: On success, the sent voice message is returned. + + ``None`` -- In case the upload is deliberately stopped with :meth:`stop_transmission`. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ file = None style = self.html if parse_mode.lower() == "html" else self.markdown diff --git a/pyrogram/client/methods/messages/stop_poll.py b/pyrogram/client/methods/messages/stop_poll.py index a5a4ecc8..4179cce4 100644 --- a/pyrogram/client/methods/messages/stop_poll.py +++ b/pyrogram/client/methods/messages/stop_poll.py @@ -34,7 +34,7 @@ class StopPoll(BaseClient): Stopped polls can't be reopened and nobody will be able to vote in it anymore. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -47,10 +47,10 @@ class StopPoll(BaseClient): An InlineKeyboardMarkup object. Returns: - On success, the stopped :obj:`Poll ` with the final results is returned. + :obj:`Poll`: On success, the stopped poll with the final results is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ poll = self.get_messages(chat_id, message_id).poll diff --git a/pyrogram/client/methods/messages/vote_poll.py b/pyrogram/client/methods/messages/vote_poll.py index 58f21a6c..5e7b8ce8 100644 --- a/pyrogram/client/methods/messages/vote_poll.py +++ b/pyrogram/client/methods/messages/vote_poll.py @@ -32,7 +32,7 @@ class VotePoll(BaseClient): ) -> "pyrogram.Poll": """Use this method to vote a poll. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -45,10 +45,10 @@ class VotePoll(BaseClient): Index of the poll option you want to vote for (0 to 9). Returns: - On success, the :obj:`Poll ` with the chosen option is returned. + :obj:`Poll` - On success, the poll with the chosen option is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ poll = self.get_messages(chat_id, message_id).poll diff --git a/pyrogram/client/methods/password/change_cloud_password.py b/pyrogram/client/methods/password/change_cloud_password.py index 2f8cfbd6..b9ee37d5 100644 --- a/pyrogram/client/methods/password/change_cloud_password.py +++ b/pyrogram/client/methods/password/change_cloud_password.py @@ -32,7 +32,7 @@ class ChangeCloudPassword(BaseClient): ) -> bool: """Use this method to change your Two-Step Verification password (Cloud Password) with a new one. - Args: + Parameters: current_password (``str``): Your current password. @@ -43,11 +43,11 @@ class ChangeCloudPassword(BaseClient): A new password hint. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` in case there is no cloud password to change. + RPCError: In case of a Telegram RPC error. + ValueError: In case there is no cloud password to change. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/password/enable_cloud_password.py b/pyrogram/client/methods/password/enable_cloud_password.py index b29dcfd3..e2e05633 100644 --- a/pyrogram/client/methods/password/enable_cloud_password.py +++ b/pyrogram/client/methods/password/enable_cloud_password.py @@ -34,7 +34,7 @@ class EnableCloudPassword(BaseClient): This password will be asked when you log-in on a new device in addition to the SMS code. - Args: + Parameters: password (``str``): Your password. @@ -45,11 +45,11 @@ class EnableCloudPassword(BaseClient): Recovery e-mail. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` in case there is already a cloud password enabled. + RPCError: In case of a Telegram RPC error. + ValueError: In case there is already a cloud password enabled. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/password/remove_cloud_password.py b/pyrogram/client/methods/password/remove_cloud_password.py index 6e9a0ab4..37160530 100644 --- a/pyrogram/client/methods/password/remove_cloud_password.py +++ b/pyrogram/client/methods/password/remove_cloud_password.py @@ -28,16 +28,16 @@ class RemoveCloudPassword(BaseClient): ) -> bool: """Use this method to turn off the Two-Step Verification security feature (Cloud Password) on your account. - Args: + Parameters: password (``str``): Your current password. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. - ``ValueError`` in case there is no cloud password to remove. + RPCError: In case of a Telegram RPC error. + ValueError: In case there is no cloud password to remove. """ r = self.send(functions.account.GetPassword()) diff --git a/pyrogram/client/methods/users/delete_user_profile_photos.py b/pyrogram/client/methods/users/delete_user_profile_photos.py index bd9fc98e..4e962245 100644 --- a/pyrogram/client/methods/users/delete_user_profile_photos.py +++ b/pyrogram/client/methods/users/delete_user_profile_photos.py @@ -31,16 +31,16 @@ class DeleteUserProfilePhotos(BaseClient): ) -> bool: """Use this method to delete your own profile photos. - Args: + Parameters: id (``str`` | ``list``): - A single :obj:`Photo ` id as string or multiple ids as list of strings for deleting + A single :obj:`Photo` id as string or multiple ids as list of strings for deleting more than one photos at once. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ id = id if isinstance(id, list) else [id] input_photos = [] diff --git a/pyrogram/client/methods/users/get_me.py b/pyrogram/client/methods/users/get_me.py index c8b6c1f1..03d3cdf1 100644 --- a/pyrogram/client/methods/users/get_me.py +++ b/pyrogram/client/methods/users/get_me.py @@ -26,10 +26,10 @@ class GetMe(BaseClient): """A simple method for testing your authorization. Requires no parameters. Returns: - Basic information about the user or bot in form of a :obj:`User` object + :obj:`User`: Basic information about the user or bot. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return pyrogram.User._parse( self, diff --git a/pyrogram/client/methods/users/get_user_profile_photos.py b/pyrogram/client/methods/users/get_user_profile_photos.py index ac7a872e..41dd2593 100644 --- a/pyrogram/client/methods/users/get_user_profile_photos.py +++ b/pyrogram/client/methods/users/get_user_profile_photos.py @@ -32,7 +32,7 @@ class GetUserProfilePhotos(BaseClient): ) -> "pyrogram.UserProfilePhotos": """Use this method to get a list of profile pictures for a user. - Args: + Parameters: user_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -47,10 +47,10 @@ class GetUserProfilePhotos(BaseClient): Values between 1—100 are accepted. Defaults to 100. Returns: - On success, a :obj:`UserProfilePhotos` object is returned. + :obj:`UserProfilePhotos`: On success, an object containing a list of the profile photos is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return pyrogram.UserProfilePhotos._parse( self, diff --git a/pyrogram/client/methods/users/get_user_profile_photos_count.py b/pyrogram/client/methods/users/get_user_profile_photos_count.py index fdb81790..595352c3 100644 --- a/pyrogram/client/methods/users/get_user_profile_photos_count.py +++ b/pyrogram/client/methods/users/get_user_profile_photos_count.py @@ -26,17 +26,17 @@ class GetUserProfilePhotosCount(BaseClient): def get_user_profile_photos_count(self, user_id: Union[int, str]) -> int: """Use this method to get the total count of profile pictures for a user. - Args: + Parameters: user_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". For a contact that exists in your Telegram address book you can use his phone number (str). Returns: - On success, an integer is returned. + ``int``: On success, an integer is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ r = self.send( diff --git a/pyrogram/client/methods/users/get_users.py b/pyrogram/client/methods/users/get_users.py index 7e6ebd6b..b1314349 100644 --- a/pyrogram/client/methods/users/get_users.py +++ b/pyrogram/client/methods/users/get_users.py @@ -31,19 +31,19 @@ class GetUsers(BaseClient): """Use this method to get information about a user. You can retrieve up to 200 users at once. - Args: + Parameters: user_ids (``iterable``): A list of User identifiers (id or username) or a single user id/username. For a contact that exists in your Telegram address book you can use his phone number (str). Iterators and Generators are also accepted. Returns: - On success and in case *user_ids* was an iterable, the returned value will be a list of the requested - :obj:`Users ` even if a list contains just one element, otherwise if - *user_ids* was an integer or string, the single requested :obj:`User` is returned. + :obj:`User`: In case *user_ids* was an integer or string. + + List of :obj:`User` -- In case *user_ids* was an iterable, even if the iterable contained one item only. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ is_iterable = not isinstance(user_ids, (int, str)) user_ids = list(user_ids) if is_iterable else [user_ids] diff --git a/pyrogram/client/methods/users/set_user_profile_photo.py b/pyrogram/client/methods/users/set_user_profile_photo.py index af02a12d..e873cf40 100644 --- a/pyrogram/client/methods/users/set_user_profile_photo.py +++ b/pyrogram/client/methods/users/set_user_profile_photo.py @@ -30,16 +30,16 @@ class SetUserProfilePhoto(BaseClient): This method only works for Users. Bots profile photos must be set using BotFather. - Args: + Parameters: photo (``str``): Profile photo to set. Pass a file path as string to upload a new photo that exists on your local machine. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return bool( diff --git a/pyrogram/client/methods/users/update_username.py b/pyrogram/client/methods/users/update_username.py index d0c87eb2..8b5b37ae 100644 --- a/pyrogram/client/methods/users/update_username.py +++ b/pyrogram/client/methods/users/update_username.py @@ -33,15 +33,15 @@ class UpdateUsername(BaseClient): them from scratch using BotFather. To update a channel or supergroup username you can use :meth:`update_chat_username`. - Args: + Parameters: username (``str`` | ``None``): - Username to set. "" (empty string) or None to remove the username. + Username to set. "" (empty string) or None to remove it. Returns: - True on success. + ``bool``: True on success. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return bool( diff --git a/pyrogram/client/types/inline_mode/inline_query.py b/pyrogram/client/types/inline_mode/inline_query.py index 9c1c02ac..a5190452 100644 --- a/pyrogram/client/types/inline_mode/inline_query.py +++ b/pyrogram/client/types/inline_mode/inline_query.py @@ -31,11 +31,11 @@ class InlineQuery(PyrogramType, Update): """This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. - Args: + Parameters: id (``str``): Unique identifier for this query. - from_user (:obj:`User `): + from_user (:obj:`User`): Sender. query (``str``): @@ -44,7 +44,7 @@ class InlineQuery(PyrogramType, Update): offset (``str``): Offset of the results to be returned, can be controlled by the bot. - location (:obj:`Location `. *optional*): + location (:obj:`Location`. *optional*): Sender location, only for bots that request user location. """ __slots__ = ["id", "from_user", "query", "offset", "location"] @@ -108,7 +108,7 @@ class InlineQuery(PyrogramType, Update): inline_query.answer([...]) - Args: + Parameters: results (List of :obj:`InlineQueryResult `): A list of results for the inline query. diff --git a/pyrogram/client/types/inline_mode/inline_query_result_article.py b/pyrogram/client/types/inline_mode/inline_query_result_article.py index 8d0089c3..bc0b4e20 100644 --- a/pyrogram/client/types/inline_mode/inline_query_result_article.py +++ b/pyrogram/client/types/inline_mode/inline_query_result_article.py @@ -27,7 +27,7 @@ class InlineQueryResultArticle(InlineQueryResult): TODO: Hide url? - Args: + Parameters: id (``str``): Unique identifier for this result, 1-64 bytes. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py index a67163c6..0ef30b20 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_audio.py @@ -25,7 +25,7 @@ class InlineQueryResultAudio(PyrogramType): Attributes: ID: ``0xb0700004`` - Args: + Parameters: type (``str``): Type of the result, must be audio. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py index f6ed1f15..dc51139b 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_audio.py @@ -31,7 +31,7 @@ class InlineQueryResultCachedAudio(PyrogramType): By default, this audio file will be sent by the user. Alternatively, you can use *input_message_content* to send a message with the specified content instead of the audio. - Args: + Parameters: id (``str``): Unique identifier for this result, 1-64 bytes. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py index ab1637d2..e2873638 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_document.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedDocument(PyrogramType): Attributes: ID: ``0xb0700015`` - Args: + Parameters: type (``str``): Type of the result, must be document. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py index 4c457873..8b523dbd 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_gif.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedGif(PyrogramType): Attributes: ID: ``0xb0700012`` - Args: + Parameters: type (``str``): Type of the result, must be gif. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py index 93ec1efb..2082150d 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_mpeg4_gif.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedMpeg4Gif(PyrogramType): Attributes: ID: ``0xb0700013`` - Args: + Parameters: type (``str``): Type of the result, must be mpeg4_gif. @@ -47,7 +47,7 @@ class InlineQueryResultCachedMpeg4Gif(PyrogramType): reply_markup (:obj:`InlineKeyboardMarkup `, optional): Inline keyboard attached to the message. - input_message_content (:obj:`InputMessageContent `, optional): + input_message_content (:obj:`InputMessageContent`, optional): Content of the message to be sent instead of the video animation. """ diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py index ee6b2654..20c1adbc 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_photo.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedPhoto(PyrogramType): Attributes: ID: ``0xb0700011`` - Args: + Parameters: type (``str``): Type of the result, must be photo. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py index 6142b1fa..06944deb 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_sticker.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedSticker(PyrogramType): Attributes: ID: ``0xb0700014`` - Args: + Parameters: type (``str``): Type of the result, must be sticker. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py index 8c00c61a..e47cae1b 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_video.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedVideo(PyrogramType): Attributes: ID: ``0xb0700016`` - Args: + Parameters: type (``str``): Type of the result, must be video. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py index 741df389..3f8bb6a3 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_cached_voice.py @@ -25,7 +25,7 @@ class InlineQueryResultCachedVoice(PyrogramType): Attributes: ID: ``0xb0700017`` - Args: + Parameters: type (``str``): Type of the result, must be voice. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py index e26af4ea..60512f0d 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_contact.py @@ -25,7 +25,7 @@ class InlineQueryResultContact(PyrogramType): Attributes: ID: ``0xb0700009`` - Args: + Parameters: type (``str``): Type of the result, must be contact. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py index 93b8fcae..148ec01d 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_document.py @@ -25,7 +25,7 @@ class InlineQueryResultDocument(PyrogramType): Attributes: ID: ``0xb0700006`` - Args: + Parameters: type (``str``): Type of the result, must be document. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py index 3e7cfb73..faebacea 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_game.py @@ -25,7 +25,7 @@ class InlineQueryResultGame(PyrogramType): Attributes: ID: ``0xb0700010`` - Args: + Parameters: type (``str``): Type of the result, must be game. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py index 13f4fc18..d84e098b 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_gif.py @@ -25,7 +25,7 @@ class InlineQueryResultGif(PyrogramType): Attributes: ID: ``0xb0700001`` - Args: + Parameters: type (``str``): Type of the result, must be gif. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py index 176591d2..cd05c832 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_location.py @@ -25,7 +25,7 @@ class InlineQueryResultLocation(PyrogramType): Attributes: ID: ``0xb0700007`` - Args: + Parameters: type (``str``): Type of the result, must be location. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py index 37aa8986..cb704eeb 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_mpeg4_gif.py @@ -25,7 +25,7 @@ class InlineQueryResultMpeg4Gif(PyrogramType): Attributes: ID: ``0xb0700002`` - Args: + Parameters: type (``str``): Type of the result, must be mpeg4_gif. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py index 2ba7c312..3412b3f4 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_photo.py @@ -25,7 +25,7 @@ class InlineQueryResultPhoto(PyrogramType): """Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. - Args: + Parameters: id (``str``): Unique identifier for this result, 1-64 bytes. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py index 23ddfc35..1dee9509 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_venue.py @@ -25,7 +25,7 @@ class InlineQueryResultVenue(PyrogramType): Attributes: ID: ``0xb0700008`` - Args: + Parameters: type (``str``): Type of the result, must be venue. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py index 9b1723e1..22d810e1 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_video.py @@ -25,7 +25,7 @@ class InlineQueryResultVideo(PyrogramType): Attributes: ID: ``0xb0700003`` - Args: + Parameters: type (``str``): Type of the result, must be video. diff --git a/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py b/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py index 188063ec..73d7fb1d 100644 --- a/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py +++ b/pyrogram/client/types/inline_mode/todo/inline_query_result_voice.py @@ -25,7 +25,7 @@ class InlineQueryResultVoice(PyrogramType): Attributes: ID: ``0xb0700005`` - Args: + Parameters: type (``str``): Type of the result, must be voice. diff --git a/pyrogram/client/types/input_media/input_media.py b/pyrogram/client/types/input_media/input_media.py index 3062f136..1e0fbc01 100644 --- a/pyrogram/client/types/input_media/input_media.py +++ b/pyrogram/client/types/input_media/input_media.py @@ -22,11 +22,11 @@ from ..pyrogram_type import PyrogramType class InputMedia(PyrogramType): """This object represents the content of a media message to be sent. It should be one of: - - :obj:`InputMediaAnimation ` - - :obj:`InputMediaDocument ` - - :obj:`InputMediaAudio ` - - :obj:`InputMediaPhoto ` - - :obj:`InputMediaVideo ` + - :obj:`InputMediaAnimation` + - :obj:`InputMediaDocument` + - :obj:`InputMediaAudio` + - :obj:`InputMediaPhoto` + - :obj:`InputMediaVideo` """ __slots__ = ["media", "caption", "parse_mode"] diff --git a/pyrogram/client/types/input_media/input_media_animation.py b/pyrogram/client/types/input_media/input_media_animation.py index 6c06df7b..177bd9ad 100644 --- a/pyrogram/client/types/input_media/input_media_animation.py +++ b/pyrogram/client/types/input_media/input_media_animation.py @@ -22,7 +22,7 @@ from . import InputMedia class InputMediaAnimation(InputMedia): """This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. - Args: + Parameters: media (``str``): Animation to send. Pass a file_id as string to send a file that exists on the Telegram servers or @@ -38,9 +38,8 @@ class InputMediaAnimation(InputMedia): Caption of the animation to be sent, 0-1024 characters parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your caption. Defaults to "markdown". width (``int``, *optional*): Animation width. diff --git a/pyrogram/client/types/input_media/input_media_audio.py b/pyrogram/client/types/input_media/input_media_audio.py index 6b7659fe..152532fa 100644 --- a/pyrogram/client/types/input_media/input_media_audio.py +++ b/pyrogram/client/types/input_media/input_media_audio.py @@ -23,7 +23,7 @@ class InputMediaAudio(InputMedia): """This object represents an audio to be sent inside an album. It is intended to be used with :obj:`send_media_group() `. - Args: + Parameters: media (``str``): Audio to send. Pass a file_id as string to send an audio that exists on the Telegram servers or @@ -39,9 +39,8 @@ class InputMediaAudio(InputMedia): Caption of the audio to be sent, 0-1024 characters parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of the audio in seconds diff --git a/pyrogram/client/types/input_media/input_media_document.py b/pyrogram/client/types/input_media/input_media_document.py index a5d36261..046b731c 100644 --- a/pyrogram/client/types/input_media/input_media_document.py +++ b/pyrogram/client/types/input_media/input_media_document.py @@ -22,7 +22,7 @@ from . import InputMedia class InputMediaDocument(InputMedia): """This object represents a general file to be sent. - Args: + Parameters: media (``str``): File to send. Pass a file_id as string to send a file that exists on the Telegram servers or @@ -38,9 +38,8 @@ class InputMediaDocument(InputMedia): Caption of the document to be sent, 0-1024 characters parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your caption. Defaults to "markdown". """ __slots__ = ["thumb"] diff --git a/pyrogram/client/types/input_media/input_media_photo.py b/pyrogram/client/types/input_media/input_media_photo.py index e6bba03b..2797bd5f 100644 --- a/pyrogram/client/types/input_media/input_media_photo.py +++ b/pyrogram/client/types/input_media/input_media_photo.py @@ -23,7 +23,7 @@ class InputMediaPhoto(InputMedia): """This object represents a photo to be sent inside an album. It is intended to be used with :obj:`send_media_group() `. - Args: + Parameters: media (``str``): Photo to send. Pass a file_id as string to send a photo that exists on the Telegram servers or @@ -34,9 +34,8 @@ class InputMediaPhoto(InputMedia): Caption of the photo to be sent, 0-1024 characters parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your caption. Defaults to "markdown". """ __slots__ = [] diff --git a/pyrogram/client/types/input_media/input_media_video.py b/pyrogram/client/types/input_media/input_media_video.py index 27d166bd..319973de 100644 --- a/pyrogram/client/types/input_media/input_media_video.py +++ b/pyrogram/client/types/input_media/input_media_video.py @@ -23,7 +23,7 @@ class InputMediaVideo(InputMedia): """This object represents a video to be sent inside an album. It is intended to be used with :obj:`send_media_group() `. - Args: + Parameters: media (``str``): Video to send. Pass a file_id as string to send a video that exists on the Telegram servers or @@ -40,9 +40,8 @@ class InputMediaVideo(InputMedia): Caption of the video to be sent, 0-1024 characters parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your caption. Defaults to "markdown". width (``int``, *optional*): Video width. diff --git a/pyrogram/client/types/input_media/input_phone_contact.py b/pyrogram/client/types/input_media/input_phone_contact.py index d2ac8012..02189011 100644 --- a/pyrogram/client/types/input_media/input_phone_contact.py +++ b/pyrogram/client/types/input_media/input_phone_contact.py @@ -25,7 +25,7 @@ class InputPhoneContact(PyrogramType): """This object represents a Phone Contact to be added in your Telegram address book. It is intended to be used with :meth:`add_contacts() ` - Args: + Parameters: phone (``str``): Contact's phone number diff --git a/pyrogram/client/types/input_message_content/input_text_message_content.py b/pyrogram/client/types/input_message_content/input_text_message_content.py index 0e6ffa8b..feedd298 100644 --- a/pyrogram/client/types/input_message_content/input_text_message_content.py +++ b/pyrogram/client/types/input_message_content/input_text_message_content.py @@ -24,14 +24,13 @@ from ...style import HTML, Markdown class InputTextMessageContent(InputMessageContent): """This object represents the content of a text message to be sent as the result of an inline query. - Args: + Parameters: message_text (``str``): Text of the message to be sent, 1-4096 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline URLs + in your message. Defaults to "markdown". disable_web_page_preview (``bool``, *optional*): Disables link previews for links in this message. diff --git a/pyrogram/client/types/keyboards/callback_query.py b/pyrogram/client/types/keyboards/callback_query.py index ac58338a..61bbfe40 100644 --- a/pyrogram/client/types/keyboards/callback_query.py +++ b/pyrogram/client/types/keyboards/callback_query.py @@ -32,18 +32,18 @@ class CallbackQuery(PyrogramType, Update): will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. - Args: + Parameters: id (``str``): Unique identifier for this query. - from_user (:obj:`User `): + from_user (:obj:`User`): Sender. chat_instance (``str``, *optional*): Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. - message (:obj:`Message `, *optional*): + message (:obj:`Message`, *optional*): Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old. @@ -121,7 +121,7 @@ class CallbackQuery(PyrogramType, Update): ) def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0): - """Bound method *answer* of :obj:`CallbackQuery `. + """Bound method *answer* of :obj:`CallbackQuery`. Use this method as a shortcut for: @@ -138,7 +138,7 @@ class CallbackQuery(PyrogramType, Update): callback_query.answer("Hello", show_alert=True) - Args: + Parameters: text (``str``): Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters. diff --git a/pyrogram/client/types/keyboards/force_reply.py b/pyrogram/client/types/keyboards/force_reply.py index 12969742..f48dab14 100644 --- a/pyrogram/client/types/keyboards/force_reply.py +++ b/pyrogram/client/types/keyboards/force_reply.py @@ -27,7 +27,7 @@ class ForceReply(PyrogramType): This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. - Args: + Parameters: selective (``bool``, *optional*): Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; diff --git a/pyrogram/client/types/keyboards/game_high_score.py b/pyrogram/client/types/keyboards/game_high_score.py index da6b2881..07db8e73 100644 --- a/pyrogram/client/types/keyboards/game_high_score.py +++ b/pyrogram/client/types/keyboards/game_high_score.py @@ -26,7 +26,7 @@ from pyrogram.client.types.user_and_chats import User class GameHighScore(PyrogramType): """This object represents one row of the high scores table for a game. - Args: + Parameters: user (:obj:`User`): User. diff --git a/pyrogram/client/types/keyboards/game_high_scores.py b/pyrogram/client/types/keyboards/game_high_scores.py index 3c197969..36b14c0f 100644 --- a/pyrogram/client/types/keyboards/game_high_scores.py +++ b/pyrogram/client/types/keyboards/game_high_scores.py @@ -27,11 +27,11 @@ from .game_high_score import GameHighScore class GameHighScores(PyrogramType): """This object represents the high scores table for a game. - Args: + Parameters: total_count (``int``): Total number of scores the target game has. - game_high_scores (List of :obj:`GameHighScore `): + game_high_scores (List of :obj:`GameHighScore`): Game scores. """ diff --git a/pyrogram/client/types/keyboards/inline_keyboard_button.py b/pyrogram/client/types/keyboards/inline_keyboard_button.py index a26d6ca6..ea110f7f 100644 --- a/pyrogram/client/types/keyboards/inline_keyboard_button.py +++ b/pyrogram/client/types/keyboards/inline_keyboard_button.py @@ -29,7 +29,7 @@ from ..pyrogram_type import PyrogramType class InlineKeyboardButton(PyrogramType): """This object represents one button of an inline keyboard. You must use exactly one of the optional fields. - Args: + Parameters: text (``str``): Label text on the button. diff --git a/pyrogram/client/types/keyboards/inline_keyboard_markup.py b/pyrogram/client/types/keyboards/inline_keyboard_markup.py index 54476c5e..f48f4b8c 100644 --- a/pyrogram/client/types/keyboards/inline_keyboard_markup.py +++ b/pyrogram/client/types/keyboards/inline_keyboard_markup.py @@ -26,8 +26,8 @@ from ..pyrogram_type import PyrogramType class InlineKeyboardMarkup(PyrogramType): """This object represents an inline keyboard that appears right next to the message it belongs to. - Args: - inline_keyboard (List of List of :obj:`InlineKeyboardButton `): + Parameters: + inline_keyboard (List of List of :obj:`InlineKeyboardButton`): List of button rows, each represented by a List of InlineKeyboardButton objects. """ diff --git a/pyrogram/client/types/keyboards/keyboard_button.py b/pyrogram/client/types/keyboards/keyboard_button.py index 477442cc..e0393e3d 100644 --- a/pyrogram/client/types/keyboards/keyboard_button.py +++ b/pyrogram/client/types/keyboards/keyboard_button.py @@ -26,7 +26,7 @@ class KeyboardButton(PyrogramType): For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive. - Args: + Parameters: text (``str``): Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed. diff --git a/pyrogram/client/types/keyboards/reply_keyboard_markup.py b/pyrogram/client/types/keyboards/reply_keyboard_markup.py index b0216803..32c73c6b 100644 --- a/pyrogram/client/types/keyboards/reply_keyboard_markup.py +++ b/pyrogram/client/types/keyboards/reply_keyboard_markup.py @@ -27,8 +27,8 @@ from ..pyrogram_type import PyrogramType class ReplyKeyboardMarkup(PyrogramType): """This object represents a custom keyboard with reply options. - Args: - keyboard (List of List of :obj:`KeyboardButton `): + Parameters: + keyboard (List of List of :obj:`KeyboardButton`): List of button rows, each represented by a List of KeyboardButton objects. resize_keyboard (``bool``, *optional*): diff --git a/pyrogram/client/types/keyboards/reply_keyboard_remove.py b/pyrogram/client/types/keyboards/reply_keyboard_remove.py index 75f2a7b5..560c89ee 100644 --- a/pyrogram/client/types/keyboards/reply_keyboard_remove.py +++ b/pyrogram/client/types/keyboards/reply_keyboard_remove.py @@ -25,7 +25,7 @@ class ReplyKeyboardRemove(PyrogramType): By default, custom keyboards are displayed 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 ReplyKeyboardMarkup). - Args: + Parameters: selective (``bool``, *optional*): Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; diff --git a/pyrogram/client/types/messages_and_media/animation.py b/pyrogram/client/types/messages_and_media/animation.py index 21a01e0f..25dda78e 100644 --- a/pyrogram/client/types/messages_and_media/animation.py +++ b/pyrogram/client/types/messages_and_media/animation.py @@ -28,7 +28,7 @@ from ...ext.utils import encode class Animation(PyrogramType): """This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). - Args: + Parameters: file_id (``str``): Unique identifier for this file. diff --git a/pyrogram/client/types/messages_and_media/audio.py b/pyrogram/client/types/messages_and_media/audio.py index db49f2eb..9f024ee1 100644 --- a/pyrogram/client/types/messages_and_media/audio.py +++ b/pyrogram/client/types/messages_and_media/audio.py @@ -28,14 +28,14 @@ from ...ext.utils import encode class Audio(PyrogramType): """This object represents an audio file to be treated as music by the Telegram clients. - Args: + Parameters: file_id (``str``): Unique identifier for this file. duration (``int``): Duration of the audio in seconds as defined by sender. - thumb (:obj:`PhotoSize `, *optional*): + thumb (:obj:`PhotoSize`, *optional*): Thumbnail of the music file album cover. file_name (``str``, *optional*): diff --git a/pyrogram/client/types/messages_and_media/contact.py b/pyrogram/client/types/messages_and_media/contact.py index 5abe5319..e2fba707 100644 --- a/pyrogram/client/types/messages_and_media/contact.py +++ b/pyrogram/client/types/messages_and_media/contact.py @@ -25,7 +25,7 @@ from ..pyrogram_type import PyrogramType class Contact(PyrogramType): """This object represents a phone contact. - Args: + Parameters: phone_number (``str``): Contact's phone number. diff --git a/pyrogram/client/types/messages_and_media/document.py b/pyrogram/client/types/messages_and_media/document.py index f3ccc4f8..c4c8ab16 100644 --- a/pyrogram/client/types/messages_and_media/document.py +++ b/pyrogram/client/types/messages_and_media/document.py @@ -28,11 +28,11 @@ from ...ext.utils import encode class Document(PyrogramType): """This object represents a general file (as opposed to photos, voice messages, audio files, ...). - Args: + Parameters: file_id (``str``): Unique file identifier. - thumb (:obj:`PhotoSize `, *optional*): + thumb (:obj:`PhotoSize`, *optional*): Document thumbnail as defined by sender. file_name (``str``, *optional*): diff --git a/pyrogram/client/types/messages_and_media/game.py b/pyrogram/client/types/messages_and_media/game.py index cf0b4fa6..50268153 100644 --- a/pyrogram/client/types/messages_and_media/game.py +++ b/pyrogram/client/types/messages_and_media/game.py @@ -27,7 +27,7 @@ class Game(PyrogramType): """This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. - Args: + Parameters: id (``int``): Unique identifier of the game. @@ -40,10 +40,10 @@ class Game(PyrogramType): description (``str``): Description of the game. - photo (:obj:`Photo `): + photo (:obj:`Photo`): Photo that will be displayed in the game message in chats. - animation (:obj:`Animation `, *optional*): + animation (:obj:`Animation`, *optional*): Animation that will be displayed in the game message in chats. Upload via BotFather. """ diff --git a/pyrogram/client/types/messages_and_media/location.py b/pyrogram/client/types/messages_and_media/location.py index 3a7f6d38..6af918f7 100644 --- a/pyrogram/client/types/messages_and_media/location.py +++ b/pyrogram/client/types/messages_and_media/location.py @@ -25,7 +25,7 @@ from ..pyrogram_type import PyrogramType class Location(PyrogramType): """This object represents a point on the map. - Args: + Parameters: longitude (``float``): Longitude as defined by sender. diff --git a/pyrogram/client/types/messages_and_media/message.py b/pyrogram/client/types/messages_and_media/message.py index 9234cb42..46f6187a 100644 --- a/pyrogram/client/types/messages_and_media/message.py +++ b/pyrogram/client/types/messages_and_media/message.py @@ -63,26 +63,26 @@ class Str(str): class Message(PyrogramType, Update): """This object represents a message. - Args: + Parameters: message_id (``int``): Unique message identifier inside this chat. date (``int``, *optional*): Date the message was sent in Unix time. - chat (:obj:`Chat `, *optional*): + chat (:obj:`Chat`, *optional*): Conversation the message belongs to. - from_user (:obj:`User `, *optional*): + from_user (:obj:`User`, *optional*): Sender, empty for messages sent to channels. - forward_from (:obj:`User `, *optional*): + forward_from (:obj:`User`, *optional*): For forwarded messages, sender of the original message. forward_sender_name (``str``, *optional*): For messages forwarded from users who have hidden their accounts, name of the user. - forward_from_chat (:obj:`Chat `, *optional*): + forward_from_chat (:obj:`Chat`, *optional*): For messages forwarded from channels, information about the original channel. forward_from_message_id (``int``, *optional*): @@ -94,7 +94,7 @@ class Message(PyrogramType, Update): forward_date (``int``, *optional*): For forwarded messages, date the original message was sent in Unix time. - reply_to_message (:obj:`Message `, *optional*): + reply_to_message (:obj:`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. @@ -131,38 +131,38 @@ class Message(PyrogramType, Update): *text.html* to get the marked up message text. In case there is no entity, the fields will contain the same text as *text*. - entities (List of :obj:`MessageEntity `, *optional*): + entities (List of :obj:`MessageEntity`, *optional*): For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. - caption_entities (List of :obj:`MessageEntity `, *optional*): + caption_entities (List of :obj:`MessageEntity`, *optional*): For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption. - audio (:obj:`Audio `, *optional*): + audio (:obj:`Audio`, *optional*): Message is an audio file, information about the file. - document (:obj:`Document `, *optional*): + document (:obj:`Document`, *optional*): Message is a general file, information about the file. - photo (:obj:`Photo `, *optional*): + photo (:obj:`Photo`, *optional*): Message is a photo, information about the photo. - sticker (:obj:`Sticker `, *optional*): + sticker (:obj:`Sticker`, *optional*): Message is a sticker, information about the sticker. - animation (:obj:`Animation `, *optional*): + animation (:obj:`Animation`, *optional*): Message is an animation, information about the animation. - game (:obj:`Game `, *optional*): + game (:obj:`Game`, *optional*): Message is a game, information about the game. - video (:obj:`Video `, *optional*): + video (:obj:`Video`, *optional*): Message is a video, information about the video. - voice (:obj:`Voice `, *optional*): + voice (:obj:`Voice`, *optional*): Message is a voice message, information about the file. - video_note (:obj:`VideoNote `, *optional*): + video_note (:obj:`VideoNote`, *optional*): Message is a video note, information about the video message. caption (``str``, *optional*): @@ -171,13 +171,13 @@ class Message(PyrogramType, Update): *caption.html* to get the marked up caption text. In case there is no caption entity, the fields will contain the same text as *caption*. - contact (:obj:`Contact `, *optional*): + contact (:obj:`Contact`, *optional*): Message is a shared contact, information about the contact. - location (:obj:`Location `, *optional*): + location (:obj:`Location`, *optional*): Message is a shared location, information about the location. - venue (:obj:`Venue `, *optional*): + venue (:obj:`Venue`, *optional*): Message is a venue, information about the venue. web_page (``bool``, *optional*): @@ -186,20 +186,20 @@ class Message(PyrogramType, Update): web page preview. In future versions this property could turn into a full web page object that contains more details. - poll (:obj:`Poll `, *optional*): + poll (:obj:`Poll`, *optional*): Message is a native poll, information about the poll. - new_chat_members (List of :obj:`User `, *optional*): + new_chat_members (List of :obj:`User`, *optional*): New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). - left_chat_member (:obj:`User `, *optional*): + left_chat_member (:obj:`User`, *optional*): A member was removed from the group, information about them (this member may be the bot itself). new_chat_title (``str``, *optional*): A chat title was changed to this value. - new_chat_photo (:obj:`Photo `, *optional*): + new_chat_photo (:obj:`Photo`, *optional*): A chat photo was change to this value. delete_chat_photo (``bool``, *optional*): @@ -232,19 +232,19 @@ class Message(PyrogramType, Update): in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. - pinned_message (:obj:`Message `, *optional*): + pinned_message (:obj:`Message`, *optional*): Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. - game_high_score (:obj:`GameHighScore `, *optional*): + game_high_score (:obj:`GameHighScore`, *optional*): The game score for a user. The reply_to_message field will contain the game Message. views (``int``, *optional*): Channel post views. - via_bot (:obj:`User `): + via_bot (:obj:`User`): The information of the bot that generated the message from an inline query of a user. outgoing (``bool``, *optional*): @@ -662,7 +662,7 @@ class Message(PyrogramType, Update): reply_to_message_id: int = None, reply_markup=None ) -> "Message": - """Bound method *reply* of :obj:`Message `. + """Bound method *reply* of :obj:`Message`. Use as a shortcut for: @@ -679,7 +679,7 @@ class Message(PyrogramType, Update): message.reply("hello", quote=True) - Args: + Parameters: text (``str``): Text of the message to be sent. @@ -689,9 +689,8 @@ class Message(PyrogramType, Update): Defaults to ``True`` in group chats and ``False`` in private chats. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your message. Defaults to "markdown". disable_web_page_preview (``bool``, *optional*): Disables link previews for links in this message. @@ -711,7 +710,7 @@ class Message(PyrogramType, Update): On success, the sent Message is returned. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -750,7 +749,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_animation* of :obj:`Message `. + """Bound method *reply_animation* of :obj:`Message`. Use as a shortcut for: @@ -766,7 +765,7 @@ class Message(PyrogramType, Update): message.reply_animation(animation) - Args: + Parameters: animation (``str``): Animation to send. Pass a file_id as string to send an animation that exists on the Telegram servers, @@ -782,9 +781,8 @@ class Message(PyrogramType, Update): Animation caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of sent animation in seconds. @@ -822,7 +820,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -836,11 +834,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -885,7 +883,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_audio* of :obj:`Message `. + """Bound method *reply_audio* of :obj:`Message`. Use as a shortcut for: @@ -901,7 +899,7 @@ class Message(PyrogramType, Update): message.reply_audio(audio) - Args: + Parameters: audio (``str``): Audio file to send. Pass a file_id as string to send an audio file that exists on the Telegram servers, @@ -917,9 +915,8 @@ class Message(PyrogramType, Update): Audio caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of the audio in seconds. @@ -957,7 +954,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -971,11 +968,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1014,7 +1011,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_cached_media* of :obj:`Message `. + """Bound method *reply_cached_media* of :obj:`Message`. Use as a shortcut for: @@ -1030,7 +1027,7 @@ class Message(PyrogramType, Update): message.reply_cached_media(file_id) - Args: + Parameters: file_id (``str``): Media to send. Pass a file_id as string to send a media that exists on the Telegram servers. @@ -1044,9 +1041,8 @@ class Message(PyrogramType, Update): Media caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". disable_notification (``bool``, *optional*): Sends the message silently. @@ -1060,10 +1056,10 @@ class Message(PyrogramType, Update): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1086,7 +1082,7 @@ class Message(PyrogramType, Update): action: Union[ChatAction, str], progress: int = 0 ) -> "Message": - """Bound method *reply_chat_action* of :obj:`Message `. + """Bound method *reply_chat_action* of :obj:`Message`. Use as a shortcut for: @@ -1102,7 +1098,7 @@ class Message(PyrogramType, Update): message.reply_chat_action("typing") - Args: + Parameters: action (:obj:`ChatAction ` | ``str``): Type of action to broadcast. Choose one from the :class:`ChatAction ` enumeration, @@ -1117,7 +1113,7 @@ class Message(PyrogramType, Update): On success, True is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. ``ValueError`` if the provided string is not a valid ChatAction. """ return self._client.send_chat_action( @@ -1142,7 +1138,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_contact* of :obj:`Message `. + """Bound method *reply_contact* of :obj:`Message`. Use as a shortcut for: @@ -1159,7 +1155,7 @@ class Message(PyrogramType, Update): message.reply_contact(phone_number, "Dan") - Args: + Parameters: phone_number (``str``): Contact's phone number. @@ -1189,10 +1185,10 @@ class Message(PyrogramType, Update): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1229,7 +1225,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_document* of :obj:`Message `. + """Bound method *reply_document* of :obj:`Message`. Use as a shortcut for: @@ -1245,7 +1241,7 @@ class Message(PyrogramType, Update): message.reply_document(document) - Args: + Parameters: document (``str``): File to send. Pass a file_id as string to send a file that exists on the Telegram servers, @@ -1267,9 +1263,8 @@ class Message(PyrogramType, Update): Document caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". disable_notification (``bool``, *optional*): Sends the message silently. @@ -1292,7 +1287,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -1306,11 +1301,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1344,7 +1339,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_game* of :obj:`Message `. + """Bound method *reply_game* of :obj:`Message`. Use as a shortcut for: @@ -1360,7 +1355,7 @@ class Message(PyrogramType, Update): message.reply_game("lumberjack") - Args: + Parameters: game_short_name (``str``): Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. @@ -1384,7 +1379,7 @@ class Message(PyrogramType, Update): On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1409,7 +1404,7 @@ class Message(PyrogramType, Update): reply_to_message_id: int = None, hide_via: bool = None ) -> "Message": - """Bound method *reply_inline_bot_result* of :obj:`Message `. + """Bound method *reply_inline_bot_result* of :obj:`Message`. Use as a shortcut for: @@ -1426,7 +1421,7 @@ class Message(PyrogramType, Update): message.reply_inline_bot_result(query_id, result_id) - Args: + Parameters: query_id (``int``): Unique identifier for the answered query. @@ -1452,7 +1447,7 @@ class Message(PyrogramType, Update): On success, the sent Message is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1483,7 +1478,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_location* of :obj:`Message `. + """Bound method *reply_location* of :obj:`Message`. Use as a shortcut for: @@ -1500,7 +1495,7 @@ class Message(PyrogramType, Update): message.reply_location(41.890251, 12.492373) - Args: + Parameters: latitude (``float``): Latitude of the location. @@ -1524,10 +1519,10 @@ class Message(PyrogramType, Update): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1551,7 +1546,7 @@ class Message(PyrogramType, Update): disable_notification: bool = None, reply_to_message_id: int = None ) -> "Message": - """Bound method *reply_media_group* of :obj:`Message `. + """Bound method *reply_media_group* of :obj:`Message`. Use as a shortcut for: @@ -1567,7 +1562,7 @@ class Message(PyrogramType, Update): message.reply_media_group(list_of_media) - Args: + Parameters: media (``list``): A list containing either :obj:`InputMediaPhoto ` or :obj:`InputMediaVideo ` objects @@ -1586,11 +1581,11 @@ class Message(PyrogramType, Update): If the message is a reply, ID of the original message. Returns: - On success, a :obj:`Messages ` object is returned containing all the + On success, a :obj:`Messages` object is returned containing all the single messages sent. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1623,7 +1618,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_photo* of :obj:`Message `. + """Bound method *reply_photo* of :obj:`Message`. Use as a shortcut for: @@ -1639,7 +1634,7 @@ class Message(PyrogramType, Update): message.reply_photo(photo) - Args: + Parameters: photo (``str``): Photo to send. Pass a file_id as string to send a photo that exists on the Telegram servers, @@ -1655,9 +1650,8 @@ class Message(PyrogramType, Update): Photo caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". ttl_seconds (``int``, *optional*): Self-Destruct Timer. @@ -1685,7 +1679,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -1699,11 +1693,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1738,7 +1732,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_poll* of :obj:`Message `. + """Bound method *reply_poll* of :obj:`Message`. Use as a shortcut for: @@ -1755,7 +1749,7 @@ class Message(PyrogramType, Update): message.reply_poll("Is Pyrogram the best?", ["Yes", "Yes"]) - Args: + Parameters: question (``str``): The poll question, as string. @@ -1779,10 +1773,10 @@ class Message(PyrogramType, Update): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1814,7 +1808,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_sticker* of :obj:`Message `. + """Bound method *reply_sticker* of :obj:`Message`. Use as a shortcut for: @@ -1830,7 +1824,7 @@ class Message(PyrogramType, Update): message.reply_sticker(sticker) - Args: + Parameters: sticker (``str``): Sticker to send. Pass a file_id as string to send a sticker that exists on the Telegram servers, @@ -1863,7 +1857,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -1877,11 +1871,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -1917,7 +1911,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *reply_venue* of :obj:`Message `. + """Bound method *reply_venue* of :obj:`Message`. Use as a shortcut for: @@ -1936,7 +1930,7 @@ class Message(PyrogramType, Update): message.reply_venue(41.890251, 12.492373, "Coliseum", "Piazza del Colosseo, 1, 00184 Roma RM") - Args: + Parameters: latitude (``float``): Latitude of the venue. @@ -1973,10 +1967,10 @@ class Message(PyrogramType, Update): instructions to remove reply keyboard or to force a reply from the user. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -2019,7 +2013,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_video* of :obj:`Message `. + """Bound method *reply_video* of :obj:`Message`. Use as a shortcut for: @@ -2035,7 +2029,7 @@ class Message(PyrogramType, Update): message.reply_video(video) - Args: + Parameters: video (``str``): Video to send. Pass a file_id as string to send a video that exists on the Telegram servers, @@ -2051,9 +2045,8 @@ class Message(PyrogramType, Update): Video caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of sent video in seconds. @@ -2094,7 +2087,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -2108,11 +2101,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -2155,7 +2148,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_video_note* of :obj:`Message `. + """Bound method *reply_video_note* of :obj:`Message`. Use as a shortcut for: @@ -2171,7 +2164,7 @@ class Message(PyrogramType, Update): message.reply_video_note(video_note) - Args: + Parameters: video_note (``str``): Video note to send. Pass a file_id as string to send a video note that exists on the Telegram servers, or @@ -2216,7 +2209,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -2230,11 +2223,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -2273,7 +2266,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *reply_voice* of :obj:`Message `. + """Bound method *reply_voice* of :obj:`Message`. Use as a shortcut for: @@ -2289,7 +2282,7 @@ class Message(PyrogramType, Update): message.reply_voice(voice) - Args: + Parameters: voice (``str``): Audio file to send. Pass a file_id as string to send an audio that exists on the Telegram servers, @@ -2305,9 +2298,8 @@ class Message(PyrogramType, Update): Voice message caption, 0-1024 characters. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your caption. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your caption. Defaults to "markdown". duration (``int``, *optional*): Duration of the voice message in seconds. @@ -2333,7 +2325,7 @@ class Message(PyrogramType, Update): a chat_id and a message_id in order to edit a message with the updated progress. Other Parameters: - client (:obj:`Client `): + client (:obj:`Client`): The Client itself, useful when you want to call other API methods inside the callback function. current (``int``): @@ -2347,11 +2339,11 @@ class Message(PyrogramType, Update): You can either keep *\*args* or add every single extra argument in your function signature. Returns: - On success, the sent :obj:`Message ` is returned. + On success, the sent :obj:`Message` is returned. In case the upload is deliberately stopped with :meth:`stop_transmission`, None is returned instead. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ if quote is None: quote = self.chat.type != "private" @@ -2384,7 +2376,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *edit* of :obj:`Message ` + """Bound method *edit* of :obj:`Message` Use as a shortcut for: @@ -2401,14 +2393,13 @@ class Message(PyrogramType, Update): message.edit("hello") - Args: + Parameters: text (``str``): New text of the message. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your message. Defaults to "markdown". disable_web_page_preview (``bool``, *optional*): Disables link previews for links in this message. @@ -2417,10 +2408,10 @@ class Message(PyrogramType, Update): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + On success, the edited :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self._client.edit_message_text( chat_id=self.chat.id, @@ -2442,7 +2433,7 @@ class Message(PyrogramType, Update): "pyrogram.ForceReply" ] = None ) -> "Message": - """Bound method *edit_caption* of :obj:`Message ` + """Bound method *edit_caption* of :obj:`Message` Use as a shortcut for: @@ -2459,23 +2450,22 @@ class Message(PyrogramType, Update): message.edit_caption("hello") - Args: + Parameters: caption (``str``): New caption of the message. parse_mode (``str``, *optional*): - Use :obj:`MARKDOWN ` or :obj:`HTML ` - if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your message. - Defaults to Markdown. + Pass "markdown" or "html" if you want Telegram apps to show bold, italic, fixed-width text or inline + URLs in your message. Defaults to "markdown". reply_markup (:obj:`InlineKeyboardMarkup`, *optional*): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + On success, the edited :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self._client.edit_message_caption( chat_id=self.chat.id, @@ -2486,7 +2476,7 @@ class Message(PyrogramType, Update): ) def edit_media(self, media: InputMedia, reply_markup: "pyrogram.InlineKeyboardMarkup" = None) -> "Message": - """Bound method *edit_media* of :obj:`Message ` + """Bound method *edit_media* of :obj:`Message` Use as a shortcut for: @@ -2503,7 +2493,7 @@ class Message(PyrogramType, Update): message.edit_media(media) - Args: + Parameters: media (:obj:`InputMediaAnimation` | :obj:`InputMediaAudio` | :obj:`InputMediaDocument` | :obj:`InputMediaPhoto` | :obj:`InputMediaVideo`) One of the InputMedia objects describing an animation, audio, document, photo or video. @@ -2511,10 +2501,10 @@ class Message(PyrogramType, Update): An InlineKeyboardMarkup object. Returns: - On success, the edited :obj:`Message ` is returned. + On success, the edited :obj:`Message` is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self._client.edit_message_media( chat_id=self.chat.id, @@ -2524,7 +2514,7 @@ class Message(PyrogramType, Update): ) def edit_reply_markup(self, reply_markup: "pyrogram.InlineKeyboardMarkup" = None) -> "Message": - """Bound method *edit_reply_markup* of :obj:`Message ` + """Bound method *edit_reply_markup* of :obj:`Message` Use as a shortcut for: @@ -2541,16 +2531,16 @@ class Message(PyrogramType, Update): message.edit_reply_markup(inline_reply_markup) - Args: + Parameters: reply_markup (:obj:`InlineKeyboardMarkup`): An InlineKeyboardMarkup object. Returns: On success, if edited message is sent by the bot, the edited - :obj:`Message ` is returned, otherwise True is returned. + :obj:`Message` is returned, otherwise True is returned. Raises: - :class:`RPCError ` in case of a Telegram RPC error. + RPCError: In case of a Telegram RPC error. """ return self._client.edit_message_reply_markup( chat_id=self.chat.id, @@ -2565,7 +2555,7 @@ class Message(PyrogramType, Update): as_copy: bool = False, remove_caption: bool = False ) -> "Message": - """Bound method *forward* of :obj:`Message `. + """Bound method *forward* of :obj:`Message`. Use as a shortcut for: @@ -2582,7 +2572,7 @@ class Message(PyrogramType, Update): message.forward(chat_id) - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -2605,7 +2595,7 @@ class Message(PyrogramType, Update): On success, the forwarded Message is returned. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ if as_copy: if self.service: @@ -2708,7 +2698,7 @@ class Message(PyrogramType, Update): ) def delete(self, revoke: bool = True): - """Bound method *delete* of :obj:`Message `. + """Bound method *delete* of :obj:`Message`. Use as a shortcut for: @@ -2724,7 +2714,7 @@ class Message(PyrogramType, Update): message.delete() - Args: + Parameters: revoke (``bool``, *optional*): Deletes messages on both parts. This is only for private cloud chats and normal groups, messages on @@ -2735,7 +2725,7 @@ class Message(PyrogramType, Update): True on success, False otherwise. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ return self._client.delete_messages( chat_id=self.chat.id, @@ -2744,7 +2734,7 @@ class Message(PyrogramType, Update): ) def click(self, x: int or str, y: int = None, quote: bool = None): - """Bound method *click* of :obj:`Message `. + """Bound method *click* of :obj:`Message`. Use as a shortcut for clicking a button attached to the message instead of. @@ -2779,7 +2769,7 @@ class Message(PyrogramType, Update): 3. Pass one string argument only (e.g.: ``.click("Settings")``, to click a button by using its label). Only the first matching button will be pressed. - Args: + Parameters: x (``int`` | ``str``): Used as integer index, integer abscissa (in pair with y) or as string label. @@ -2798,7 +2788,7 @@ class Message(PyrogramType, Update): button. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. ``ValueError``: If the provided index or position is out of range or the button label was not found ``TimeoutError``: If, after clicking an inline button, the bot fails to answer within 10 seconds """ @@ -2862,7 +2852,7 @@ class Message(PyrogramType, Update): progress: callable = None, progress_args: tuple = () ) -> "Message": - """Bound method *download* of :obj:`Message `. + """Bound method *download* of :obj:`Message`. Use as a shortcut for: @@ -2875,7 +2865,7 @@ class Message(PyrogramType, Update): message.download() - Args: + Parameters: file_name (``str``, *optional*): A custom *file_name* to be used instead of the one provided by Telegram. By default, all files are downloaded in the *downloads* folder in your working directory. @@ -2899,7 +2889,7 @@ class Message(PyrogramType, Update): On success, the absolute path of the downloaded file as string is returned, None otherwise. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. ``ValueError``: If the message doesn't contain any downloadable media """ return self._client.download_media( @@ -2911,7 +2901,7 @@ class Message(PyrogramType, Update): ) def pin(self, disable_notification: bool = None) -> "Message": - """Bound method *pin* of :obj:`Message `. + """Bound method *pin* of :obj:`Message`. Use as a shortcut for: @@ -2927,7 +2917,7 @@ class Message(PyrogramType, Update): message.pin() - Args: + Parameters: disable_notification (``bool``): Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels. diff --git a/pyrogram/client/types/messages_and_media/message_entity.py b/pyrogram/client/types/messages_and_media/message_entity.py index 160d0d1e..6fe4ef91 100644 --- a/pyrogram/client/types/messages_and_media/message_entity.py +++ b/pyrogram/client/types/messages_and_media/message_entity.py @@ -27,7 +27,7 @@ class MessageEntity(PyrogramType): """This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. - Args: + Parameters: type (``str``): Type of the entity. Can be "mention" (@username), "hashtag", "cashtag", "bot_command", "url", "email", "phone_number", "bold" @@ -43,7 +43,7 @@ class MessageEntity(PyrogramType): url (``str``, *optional*): For "text_link" only, url that will be opened after user taps on the text. - user (:obj:`User `, *optional*): + user (:obj:`User`, *optional*): For "text_mention" only, the mentioned user. """ diff --git a/pyrogram/client/types/messages_and_media/messages.py b/pyrogram/client/types/messages_and_media/messages.py index 4f78277c..4ce41aec 100644 --- a/pyrogram/client/types/messages_and_media/messages.py +++ b/pyrogram/client/types/messages_and_media/messages.py @@ -29,11 +29,11 @@ from ..user_and_chats import Chat class Messages(PyrogramType, Update): """This object represents a chat's messages. - Args: + Parameters: total_count (``int``): Total number of messages the target chat has. - messages (List of :obj:`Message `): + messages (List of :obj:`Message`): Requested messages. """ @@ -124,9 +124,9 @@ class Messages(PyrogramType, Update): as_copy: bool = False, remove_caption: bool = False ): - """Bound method *forward* of :obj:`Message `. + """Bound method *forward* of :obj:`Message`. - Args: + Parameters: chat_id (``int`` | ``str``): Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use "me" or "self". @@ -146,10 +146,10 @@ class Messages(PyrogramType, Update): Defaults to False. Returns: - On success, a :class:`Messages ` containing forwarded messages is returned. + On success, a :class:`Messages` containing forwarded messages is returned. Raises: - :class:`RPCError ` + RPCError: In case of a Telegram RPC error. """ forwarded_messages = [] diff --git a/pyrogram/client/types/messages_and_media/photo.py b/pyrogram/client/types/messages_and_media/photo.py index 6f1852fb..f7f9f4ec 100644 --- a/pyrogram/client/types/messages_and_media/photo.py +++ b/pyrogram/client/types/messages_and_media/photo.py @@ -30,14 +30,14 @@ from ...ext.utils import encode class Photo(PyrogramType): """This object represents a Photo. - Args: + Parameters: id (``str``): Unique identifier for this photo. date (``int``): Date the photo was sent in Unix time. - sizes (List of :obj:`PhotoSize `): + sizes (List of :obj:`PhotoSize`): Available sizes of this photo. """ diff --git a/pyrogram/client/types/messages_and_media/photo_size.py b/pyrogram/client/types/messages_and_media/photo_size.py index 10d00a86..a154c077 100644 --- a/pyrogram/client/types/messages_and_media/photo_size.py +++ b/pyrogram/client/types/messages_and_media/photo_size.py @@ -28,7 +28,7 @@ from ..pyrogram_type import PyrogramType class PhotoSize(PyrogramType): """This object represents one size of a photo or a file/sticker thumbnail. - Args: + Parameters: file_id (``str``): Unique identifier for this file. diff --git a/pyrogram/client/types/messages_and_media/poll.py b/pyrogram/client/types/messages_and_media/poll.py index fa68f669..602da364 100644 --- a/pyrogram/client/types/messages_and_media/poll.py +++ b/pyrogram/client/types/messages_and_media/poll.py @@ -28,7 +28,7 @@ from ..update import Update class Poll(PyrogramType, Update): """This object represents a Poll. - Args: + Parameters: id (``str``): Unique poll identifier. diff --git a/pyrogram/client/types/messages_and_media/poll_option.py b/pyrogram/client/types/messages_and_media/poll_option.py index 4b32623a..31eed702 100644 --- a/pyrogram/client/types/messages_and_media/poll_option.py +++ b/pyrogram/client/types/messages_and_media/poll_option.py @@ -23,7 +23,7 @@ from ..pyrogram_type import PyrogramType class PollOption(PyrogramType): """This object contains information about one answer option in a poll. - Args: + Parameters: text (``str``): Option text, 1-100 characters. diff --git a/pyrogram/client/types/messages_and_media/sticker.py b/pyrogram/client/types/messages_and_media/sticker.py index 1ae2c23e..e6b8de35 100644 --- a/pyrogram/client/types/messages_and_media/sticker.py +++ b/pyrogram/client/types/messages_and_media/sticker.py @@ -30,7 +30,7 @@ from ...ext.utils import encode class Sticker(PyrogramType): """This object represents a sticker. - Args: + Parameters: file_id (``str``): Unique identifier for this file. @@ -40,7 +40,7 @@ class Sticker(PyrogramType): height (``int``): Sticker height. - thumb (:obj:`PhotoSize `, *optional*): + thumb (:obj:`PhotoSize`, *optional*): Sticker thumbnail in the .webp or .jpg format. file_name (``str``, *optional*): diff --git a/pyrogram/client/types/messages_and_media/user_profile_photos.py b/pyrogram/client/types/messages_and_media/user_profile_photos.py index f162b077..66bcb51a 100644 --- a/pyrogram/client/types/messages_and_media/user_profile_photos.py +++ b/pyrogram/client/types/messages_and_media/user_profile_photos.py @@ -26,11 +26,11 @@ from ..pyrogram_type import PyrogramType class UserProfilePhotos(PyrogramType): """This object represents a user's profile pictures. - Args: + Parameters: total_count (``int``): Total number of profile pictures the target user has. - photos (List of :obj:`Photo `): + photos (List of :obj:`Photo`): Requested profile pictures. """ diff --git a/pyrogram/client/types/messages_and_media/venue.py b/pyrogram/client/types/messages_and_media/venue.py index 97829142..61e3d912 100644 --- a/pyrogram/client/types/messages_and_media/venue.py +++ b/pyrogram/client/types/messages_and_media/venue.py @@ -25,8 +25,8 @@ from ..pyrogram_type import PyrogramType class Venue(PyrogramType): """This object represents a venue. - Args: - location (:obj:`Location `): + Parameters: + location (:obj:`Location`): Venue location. title (``str``): diff --git a/pyrogram/client/types/messages_and_media/video.py b/pyrogram/client/types/messages_and_media/video.py index a45a8f8d..8c3e9c00 100644 --- a/pyrogram/client/types/messages_and_media/video.py +++ b/pyrogram/client/types/messages_and_media/video.py @@ -28,7 +28,7 @@ from ...ext.utils import encode class Video(PyrogramType): """This object represents a video file. - Args: + Parameters: file_id (``str``): Unique identifier for this file. @@ -41,7 +41,7 @@ class Video(PyrogramType): duration (``int``): Duration of the video in seconds as defined by sender. - thumb (:obj:`PhotoSize `, *optional*): + thumb (:obj:`PhotoSize`, *optional*): Video thumbnail. file_name (``str``, *optional*): diff --git a/pyrogram/client/types/messages_and_media/video_note.py b/pyrogram/client/types/messages_and_media/video_note.py index e6c2ab31..59c60c6e 100644 --- a/pyrogram/client/types/messages_and_media/video_note.py +++ b/pyrogram/client/types/messages_and_media/video_note.py @@ -28,7 +28,7 @@ from ...ext.utils import encode class VideoNote(PyrogramType): """This object represents a video note. - Args: + Parameters: file_id (``str``): Unique identifier for this file. @@ -38,7 +38,7 @@ class VideoNote(PyrogramType): duration (``int``): Duration of the video in seconds as defined by sender. - thumb (:obj:`PhotoSize `, *optional*): + thumb (:obj:`PhotoSize`, *optional*): Video thumbnail. mime_type (``str``, *optional*): diff --git a/pyrogram/client/types/messages_and_media/voice.py b/pyrogram/client/types/messages_and_media/voice.py index b4063088..87804826 100644 --- a/pyrogram/client/types/messages_and_media/voice.py +++ b/pyrogram/client/types/messages_and_media/voice.py @@ -27,7 +27,7 @@ from ...ext.utils import encode class Voice(PyrogramType): """This object represents a voice note. - Args: + Parameters: file_id (``str``): Unique identifier for this file. diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index 1d4369d4..0c6210eb 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -28,7 +28,7 @@ from ..pyrogram_type import PyrogramType class Chat(PyrogramType): """This object represents a chat. - Args: + Parameters: id (``int``): Unique identifier for this chat. @@ -58,7 +58,7 @@ class Chat(PyrogramType): Chat invite link, for supergroups and channel chats. Returned only in :meth:`get_chat() `. - pinned_message (:obj:`Message `, *optional*): + pinned_message (:obj:`Message`, *optional*): Pinned message, for supergroups and channel chats. Returned only in :meth:`get_chat() `. diff --git a/pyrogram/client/types/user_and_chats/chat_member.py b/pyrogram/client/types/user_and_chats/chat_member.py index 046d2ebc..9841af83 100644 --- a/pyrogram/client/types/user_and_chats/chat_member.py +++ b/pyrogram/client/types/user_and_chats/chat_member.py @@ -25,8 +25,8 @@ from ..pyrogram_type import PyrogramType class ChatMember(PyrogramType): """This object contains information about one member of a chat. - Args: - user (:obj:`User `): + Parameters: + user (:obj:`User`): Information about the user. status (``str``): @@ -39,17 +39,17 @@ class ChatMember(PyrogramType): is_member (``bool``, *optional*): Restricted only. True, if the user is a member of the chat at the moment of the request. - invited_by (:obj:`User `, *optional*): + invited_by (:obj:`User`, *optional*): Administrators and self member only. Information about the user who invited this member. In case the user joined by himself this will be the same as "user". - promoted_by (:obj:`User `, *optional*): + promoted_by (:obj:`User`, *optional*): Administrators only. Information about the user who promoted this member as administrator. - restricted_by (:obj:`User `, *optional*): + restricted_by (:obj:`User`, *optional*): Restricted and kicked only. Information about the user who restricted or kicked this member. - permissions (:obj:`ChatPermissions ` *optional*): + permissions (:obj:`ChatPermissions` *optional*): Administrators, restricted and kicked members only. Information about the member permissions. """ diff --git a/pyrogram/client/types/user_and_chats/chat_members.py b/pyrogram/client/types/user_and_chats/chat_members.py index 3c89b124..d7cf3b9a 100644 --- a/pyrogram/client/types/user_and_chats/chat_members.py +++ b/pyrogram/client/types/user_and_chats/chat_members.py @@ -27,7 +27,7 @@ from ..pyrogram_type import PyrogramType class ChatMembers(PyrogramType): """This object contains information about the members list of a chat. - Args: + Parameters: total_count (``int``): Total number of members the chat has. diff --git a/pyrogram/client/types/user_and_chats/chat_permissions.py b/pyrogram/client/types/user_and_chats/chat_permissions.py index 7b35b1d0..ec00272e 100644 --- a/pyrogram/client/types/user_and_chats/chat_permissions.py +++ b/pyrogram/client/types/user_and_chats/chat_permissions.py @@ -28,7 +28,7 @@ class ChatPermissions(PyrogramType): Some permissions make sense depending on the context: default chat permissions, restricted/kicked member or administrators in groups or channels. - Args: + Parameters: until_date (``int``, *optional*): Applicable to restricted and kicked members only. Date when user restrictions will be lifted, unix time. diff --git a/pyrogram/client/types/user_and_chats/chat_photo.py b/pyrogram/client/types/user_and_chats/chat_photo.py index 6fbc779d..af4f2df4 100644 --- a/pyrogram/client/types/user_and_chats/chat_photo.py +++ b/pyrogram/client/types/user_and_chats/chat_photo.py @@ -27,7 +27,7 @@ from ...ext.utils import encode class ChatPhoto(PyrogramType): """This object represents a chat photo. - Args: + Parameters: small_file_id (``str``): Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download. diff --git a/pyrogram/client/types/user_and_chats/chat_preview.py b/pyrogram/client/types/user_and_chats/chat_preview.py index ddd84b09..b6b136a1 100644 --- a/pyrogram/client/types/user_and_chats/chat_preview.py +++ b/pyrogram/client/types/user_and_chats/chat_preview.py @@ -28,7 +28,7 @@ from ..user_and_chats.user import User class ChatPreview(PyrogramType): """This object represents a chat preview. - Args: + Parameters: title (``str``): Title of the chat. diff --git a/pyrogram/client/types/user_and_chats/dialog.py b/pyrogram/client/types/user_and_chats/dialog.py index d406d783..ec011d81 100644 --- a/pyrogram/client/types/user_and_chats/dialog.py +++ b/pyrogram/client/types/user_and_chats/dialog.py @@ -26,11 +26,11 @@ from ..user_and_chats import Chat class Dialog(PyrogramType): """This object represents a dialog. - Args: + Parameters: chat (:obj:`Chat `): Conversation the dialog belongs to. - top_message (:obj:`Message `): + top_message (:obj:`Message`): The last message sent in the dialog at this time. unread_messages_count (``int``): diff --git a/pyrogram/client/types/user_and_chats/dialogs.py b/pyrogram/client/types/user_and_chats/dialogs.py index 431cca8d..97ca462b 100644 --- a/pyrogram/client/types/user_and_chats/dialogs.py +++ b/pyrogram/client/types/user_and_chats/dialogs.py @@ -28,11 +28,11 @@ from ..pyrogram_type import PyrogramType class Dialogs(PyrogramType): """This object represents a user's dialogs chunk. - Args: + Parameters: total_count (``int``): Total number of dialogs the user has. - dialogs (List of :obj:`Dialog `): + dialogs (List of :obj:`Dialog`): Requested dialogs. """ diff --git a/pyrogram/client/types/user_and_chats/user.py b/pyrogram/client/types/user_and_chats/user.py index 5718b917..976ce5a0 100644 --- a/pyrogram/client/types/user_and_chats/user.py +++ b/pyrogram/client/types/user_and_chats/user.py @@ -26,7 +26,7 @@ from ..pyrogram_type import PyrogramType class User(PyrogramType): """This object represents a Telegram user or bot. - Args: + Parameters: id (``int``): Unique identifier for this user or bot. diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py index 170ce373..0f9c003e 100644 --- a/pyrogram/client/types/user_and_chats/user_status.py +++ b/pyrogram/client/types/user_and_chats/user_status.py @@ -31,7 +31,7 @@ class UserStatus(PyrogramType, Update): You won't see exact last seen timestamps for people with whom you don't share your own. Instead, you get "recently", "within_week", "within_month" or "long_time_ago" fields set. - Args: + Parameters: user_id (``int``): User's id.