mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 05:48:14 +00:00
Clean up docstrings
This commit is contained in:
parent
bc9f902376
commit
921800f902
@ -29,8 +29,8 @@ class RequestCallbackAnswer(BaseClient):
|
|||||||
message_id: int,
|
message_id: int,
|
||||||
callback_data: bytes
|
callback_data: bytes
|
||||||
):
|
):
|
||||||
"""Use this method to request a callback answer from bots. This is the equivalent of clicking an
|
"""Use this method to request a callback answer from bots.
|
||||||
inline button containing callback data.
|
This is the equivalent of clicking an inline button containing callback data.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
|
@ -28,8 +28,9 @@ class GetChat(BaseClient):
|
|||||||
self,
|
self,
|
||||||
chat_id: Union[int, str]
|
chat_id: Union[int, str]
|
||||||
) -> "pyrogram.Chat":
|
) -> "pyrogram.Chat":
|
||||||
"""Use this method to get up to date information about the chat (current name of the user for
|
"""Use this method to get up to date information about the chat.
|
||||||
one-on-one conversations, current username of a user, group or channel, etc.)
|
Information include current name of the user for one-on-one conversations, current username of a user, group or
|
||||||
|
channel, etc.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
|
@ -34,7 +34,7 @@ class GetDialogs(BaseClient):
|
|||||||
limit: int = 100,
|
limit: int = 100,
|
||||||
pinned_only: bool = False
|
pinned_only: bool = False
|
||||||
) -> "pyrogram.Dialogs":
|
) -> "pyrogram.Dialogs":
|
||||||
"""Use this method to get a chunk of the user's dialogs
|
"""Use this method to get a chunk of the user's dialogs.
|
||||||
|
|
||||||
You can get up to 100 dialogs at once.
|
You can get up to 100 dialogs at once.
|
||||||
For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`.
|
For a more convenient way of getting a user's dialogs see :meth:`iter_dialogs`.
|
||||||
|
@ -38,9 +38,10 @@ class RestrictChatMember(BaseClient):
|
|||||||
can_invite_users: bool = False,
|
can_invite_users: bool = False,
|
||||||
can_pin_messages: bool = False
|
can_pin_messages: bool = False
|
||||||
) -> Chat:
|
) -> Chat:
|
||||||
"""Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for
|
"""Use this method to restrict a user in a supergroup.
|
||||||
this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift
|
|
||||||
restrictions from a user.
|
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:
|
Args:
|
||||||
chat_id (``int`` | ``str``):
|
chat_id (``int`` | ``str``):
|
||||||
|
@ -28,7 +28,7 @@ class DeleteContacts(BaseClient):
|
|||||||
self,
|
self,
|
||||||
ids: List[int]
|
ids: List[int]
|
||||||
):
|
):
|
||||||
"""Use this method to delete contacts from your Telegram address book
|
"""Use this method to delete contacts from your Telegram address book.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
ids (List of ``int``):
|
ids (List of ``int``):
|
||||||
|
@ -30,9 +30,8 @@ class OnCallbackQuery(BaseClient):
|
|||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling callback queries.
|
||||||
callback queries. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`CallbackQueryHandler`.
|
||||||
:class:`CallbackQueryHandler`.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||||
|
@ -30,9 +30,8 @@ class OnDeletedMessages(BaseClient):
|
|||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling deleted messages.
|
||||||
deleted messages. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`DeletedMessagesHandler`.
|
||||||
:class:`DeletedMessagesHandler`.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||||
|
@ -23,9 +23,8 @@ from ...ext import BaseClient
|
|||||||
|
|
||||||
class OnDisconnect(BaseClient):
|
class OnDisconnect(BaseClient):
|
||||||
def on_disconnect(self=None) -> callable:
|
def on_disconnect(self=None) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling disconnections.
|
||||||
disconnections. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`DisconnectHandler`.
|
||||||
:class:`DisconnectHandler`.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func: callable) -> Handler:
|
def decorator(func: callable) -> Handler:
|
||||||
|
@ -30,9 +30,8 @@ class OnInlineQuery(BaseClient):
|
|||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling inline queries.
|
||||||
inline queries. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`InlineQueryHandler`.
|
||||||
:class:`InlineQueryHandler`.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
filters (:obj:`Filters <pyrogram.Filters>`):
|
||||||
|
@ -30,9 +30,8 @@ class OnMessage(BaseClient):
|
|||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling messages.
|
||||||
messages. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`.
|
||||||
:class:`MessageHandler`.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||||
|
@ -28,9 +28,8 @@ class OnRawUpdate(BaseClient):
|
|||||||
self=None,
|
self=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling raw updates.
|
||||||
raw updates. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`RawUpdateHandler`.
|
||||||
:class:`RawUpdateHandler`.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||||
|
@ -30,9 +30,8 @@ class OnUserStatus(BaseClient):
|
|||||||
filters=None,
|
filters=None,
|
||||||
group: int = 0
|
group: int = 0
|
||||||
) -> callable:
|
) -> callable:
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling user status updates.
|
||||||
user status updates. This does the same thing as :meth:`add_handler` using the
|
This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`.
|
||||||
:class:`UserStatusHandler`.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||||
|
@ -29,7 +29,9 @@ class DeleteMessages(BaseClient):
|
|||||||
message_ids: Iterable[int],
|
message_ids: Iterable[int],
|
||||||
revoke: bool = True
|
revoke: bool = True
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to delete messages, including service messages, with the following limitations:
|
"""Use this method to delete messages, including service messages.
|
||||||
|
|
||||||
|
Deleting messages have the following limitations:
|
||||||
|
|
||||||
- A message can only be deleted if it was sent less than 48 hours ago.
|
- A message can only be deleted if it was sent less than 48 hours ago.
|
||||||
- Users can delete outgoing messages in groups and supergroups.
|
- Users can delete outgoing messages in groups and supergroups.
|
||||||
|
@ -32,7 +32,7 @@ class DownloadMedia(BaseClient):
|
|||||||
progress: callable = None,
|
progress: callable = None,
|
||||||
progress_args: tuple = ()
|
progress_args: tuple = ()
|
||||||
) -> Union[str, None]:
|
) -> Union[str, None]:
|
||||||
"""Use this method to download the media from a Message.
|
"""Use this method to download the media from a message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
message (:obj:`Message <pyrogram.Message>` | ``str``):
|
message (:obj:`Message <pyrogram.Message>` | ``str``):
|
||||||
|
@ -29,7 +29,7 @@ class DeleteUserProfilePhotos(BaseClient):
|
|||||||
self,
|
self,
|
||||||
id: Union[str, List[str]]
|
id: Union[str, List[str]]
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Use this method to delete your own profile photos
|
"""Use this method to delete your own profile photos.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
id (``str`` | ``list``):
|
id (``str`` | ``list``):
|
||||||
|
@ -21,8 +21,9 @@ from ..pyrogram_type import PyrogramType
|
|||||||
|
|
||||||
|
|
||||||
class ForceReply(PyrogramType):
|
class ForceReply(PyrogramType):
|
||||||
"""Upon receiving a message with this object, Telegram clients will display a reply interface to the user
|
"""Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
|
||||||
(act as if the user has selected the bot's message and tapped 'Reply').
|
|
||||||
|
This acts as if the user has selected the bot's message and tapped "Reply".
|
||||||
This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to
|
This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to
|
||||||
sacrifice privacy mode.
|
sacrifice privacy mode.
|
||||||
|
|
||||||
|
@ -21,10 +21,9 @@ from ..pyrogram_type import PyrogramType
|
|||||||
|
|
||||||
|
|
||||||
class ReplyKeyboardRemove(PyrogramType):
|
class ReplyKeyboardRemove(PyrogramType):
|
||||||
"""Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and
|
"""Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
|
||||||
display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent
|
By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time
|
||||||
by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a
|
keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
|
||||||
button (see ReplyKeyboardMarkup).
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
selective (``bool``, *optional*):
|
selective (``bool``, *optional*):
|
||||||
|
@ -16,16 +16,23 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from ..pyrogram_type import PyrogramType
|
||||||
|
|
||||||
class InputMedia:
|
|
||||||
|
class InputMedia(PyrogramType):
|
||||||
|
"""This object represents the content of a media message to be sent. It should be one of:
|
||||||
|
|
||||||
|
- :obj:`InputMediaAnimation <pyrogram.InputMediaAnimation>`
|
||||||
|
- :obj:`InputMediaDocument <pyrogram.InputMediaDocument>`
|
||||||
|
- :obj:`InputMediaAudio <pyrogram.InputMediaAudio>`
|
||||||
|
- :obj:`InputMediaPhoto <pyrogram.InputMediaPhoto>`
|
||||||
|
- :obj:`InputMediaVideo <pyrogram.InputMediaVideo>`
|
||||||
|
"""
|
||||||
__slots__ = ["media", "caption", "parse_mode"]
|
__slots__ = ["media", "caption", "parse_mode"]
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, media: str, caption: str, parse_mode: str):
|
||||||
self,
|
super().__init__(None)
|
||||||
media: str,
|
|
||||||
caption: str,
|
|
||||||
parse_mode: str
|
|
||||||
):
|
|
||||||
self.media = media
|
self.media = media
|
||||||
self.caption = caption
|
self.caption = caption
|
||||||
self.parse_mode = parse_mode
|
self.parse_mode = parse_mode
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
||||||
from pyrogram.session.internals import MsgId
|
from pyrogram.session.internals import MsgId
|
||||||
|
from ..pyrogram_type import PyrogramType
|
||||||
|
|
||||||
|
|
||||||
class InputPhoneContact:
|
class InputPhoneContact(PyrogramType):
|
||||||
"""This object represents a Phone Contact to be added in your Telegram address book.
|
"""This object represents a Phone Contact to be added in your Telegram address book.
|
||||||
It is intended to be used with :meth:`add_contacts() <pyrogram.Client.add_contacts>`
|
It is intended to be used with :meth:`add_contacts() <pyrogram.Client.add_contacts>`
|
||||||
|
|
||||||
@ -37,13 +38,8 @@ class InputPhoneContact:
|
|||||||
|
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, phone: str, first_name: str, last_name: str = ""):
|
||||||
self,
|
super().__init__(None)
|
||||||
phone: str,
|
|
||||||
first_name: str,
|
|
||||||
last_name: str = ""
|
|
||||||
):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __new__(cls,
|
def __new__(cls,
|
||||||
phone: str,
|
phone: str,
|
||||||
|
@ -26,7 +26,7 @@ from ...ext.utils import encode
|
|||||||
|
|
||||||
|
|
||||||
class VideoNote(PyrogramType):
|
class VideoNote(PyrogramType):
|
||||||
"""This object represents a video message (available in Telegram apps as of v.4.0).
|
"""This object represents a video note.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
file_id (``str``):
|
file_id (``str``):
|
||||||
|
@ -26,7 +26,7 @@ from ..pyrogram_type import PyrogramType
|
|||||||
|
|
||||||
|
|
||||||
class Dialogs(PyrogramType):
|
class Dialogs(PyrogramType):
|
||||||
"""This object represents a user's dialogs chunk
|
"""This object represents a user's dialogs chunk.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
total_count (``int``):
|
total_count (``int``):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user