mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Clean up docstrings
This commit is contained in:
parent
bc9f902376
commit
921800f902
@ -29,8 +29,8 @@ class RequestCallbackAnswer(BaseClient):
|
||||
message_id: int,
|
||||
callback_data: bytes
|
||||
):
|
||||
"""Use this method to request a callback answer from bots. This is the equivalent of clicking an
|
||||
inline button containing callback data.
|
||||
"""Use this method to request a callback answer from bots.
|
||||
This is the equivalent of clicking an inline button containing callback data.
|
||||
|
||||
Args:
|
||||
chat_id (``int`` | ``str``):
|
||||
|
@ -28,8 +28,9 @@ class GetChat(BaseClient):
|
||||
self,
|
||||
chat_id: Union[int, str]
|
||||
) -> "pyrogram.Chat":
|
||||
"""Use this method to get up to date information about the chat (current name of the user for
|
||||
one-on-one conversations, current username of a user, group or channel, etc.)
|
||||
"""Use this method to get up to date information about the chat.
|
||||
Information include current name of the user for one-on-one conversations, current username of a user, group or
|
||||
channel, etc.
|
||||
|
||||
Args:
|
||||
chat_id (``int`` | ``str``):
|
||||
|
@ -34,7 +34,7 @@ class GetDialogs(BaseClient):
|
||||
limit: int = 100,
|
||||
pinned_only: bool = False
|
||||
) -> "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.
|
||||
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_pin_messages: bool = False
|
||||
) -> Chat:
|
||||
"""Use this method to restrict a user in a supergroup. 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.
|
||||
"""Use this method to restrict a user in a supergroup.
|
||||
|
||||
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:
|
||||
chat_id (``int`` | ``str``):
|
||||
|
@ -28,7 +28,7 @@ class DeleteContacts(BaseClient):
|
||||
self,
|
||||
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:
|
||||
ids (List of ``int``):
|
||||
|
@ -30,9 +30,8 @@ class OnCallbackQuery(BaseClient):
|
||||
filters=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""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`.
|
||||
"""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`.
|
||||
|
||||
.. note::
|
||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||
|
@ -30,9 +30,8 @@ class OnDeletedMessages(BaseClient):
|
||||
filters=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""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`.
|
||||
"""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`.
|
||||
|
||||
.. note::
|
||||
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):
|
||||
def on_disconnect(self=None) -> callable:
|
||||
"""Use this decorator to automatically register a function for handling
|
||||
disconnections. This does the same thing as :meth:`add_handler` using the
|
||||
:class:`DisconnectHandler`.
|
||||
"""Use this decorator to automatically register a function for handling disconnections.
|
||||
This does the same thing as :meth:`add_handler` using the :class:`DisconnectHandler`.
|
||||
"""
|
||||
|
||||
def decorator(func: callable) -> Handler:
|
||||
|
@ -30,9 +30,8 @@ class OnInlineQuery(BaseClient):
|
||||
filters=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""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`.
|
||||
"""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:
|
||||
filters (:obj:`Filters <pyrogram.Filters>`):
|
||||
|
@ -30,9 +30,8 @@ class OnMessage(BaseClient):
|
||||
filters=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""Use this decorator to automatically register a function for handling
|
||||
messages. This does the same thing as :meth:`add_handler` using the
|
||||
:class:`MessageHandler`.
|
||||
"""Use this decorator to automatically register a function for handling messages.
|
||||
This does the same thing as :meth:`add_handler` using the :class:`MessageHandler`.
|
||||
|
||||
.. note::
|
||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||
|
@ -28,9 +28,8 @@ class OnRawUpdate(BaseClient):
|
||||
self=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""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`.
|
||||
"""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`.
|
||||
|
||||
.. note::
|
||||
This decorator will wrap your defined function in a tuple consisting of *(Handler, group)*.
|
||||
|
@ -30,9 +30,8 @@ class OnUserStatus(BaseClient):
|
||||
filters=None,
|
||||
group: int = 0
|
||||
) -> callable:
|
||||
"""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`.
|
||||
"""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`.
|
||||
|
||||
.. note::
|
||||
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],
|
||||
revoke: bool = True
|
||||
) -> 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.
|
||||
- Users can delete outgoing messages in groups and supergroups.
|
||||
|
@ -32,7 +32,7 @@ class DownloadMedia(BaseClient):
|
||||
progress: callable = None,
|
||||
progress_args: tuple = ()
|
||||
) -> Union[str, None]:
|
||||
"""Use this method to download the media from a Message.
|
||||
"""Use this method to download the media from a message.
|
||||
|
||||
Args:
|
||||
message (:obj:`Message <pyrogram.Message>` | ``str``):
|
||||
|
@ -29,7 +29,7 @@ class DeleteUserProfilePhotos(BaseClient):
|
||||
self,
|
||||
id: Union[str, List[str]]
|
||||
) -> bool:
|
||||
"""Use this method to delete your own profile photos
|
||||
"""Use this method to delete your own profile photos.
|
||||
|
||||
Args:
|
||||
id (``str`` | ``list``):
|
||||
|
@ -21,8 +21,9 @@ from ..pyrogram_type import PyrogramType
|
||||
|
||||
|
||||
class ForceReply(PyrogramType):
|
||||
"""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').
|
||||
"""Upon receiving a message with this object, Telegram clients will display a reply interface to the user.
|
||||
|
||||
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
|
||||
sacrifice privacy mode.
|
||||
|
||||
|
@ -21,10 +21,9 @@ from ..pyrogram_type import PyrogramType
|
||||
|
||||
|
||||
class ReplyKeyboardRemove(PyrogramType):
|
||||
"""Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and
|
||||
display the default letter-keyboard. 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).
|
||||
"""Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
|
||||
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:
|
||||
selective (``bool``, *optional*):
|
||||
|
@ -16,16 +16,23 @@
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# 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"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
media: str,
|
||||
caption: str,
|
||||
parse_mode: str
|
||||
):
|
||||
def __init__(self, media: str, caption: str, parse_mode: str):
|
||||
super().__init__(None)
|
||||
|
||||
self.media = media
|
||||
self.caption = caption
|
||||
self.parse_mode = parse_mode
|
||||
|
@ -18,9 +18,10 @@
|
||||
|
||||
from pyrogram.api.types import InputPhoneContact as RawInputPhoneContact
|
||||
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.
|
||||
It is intended to be used with :meth:`add_contacts() <pyrogram.Client.add_contacts>`
|
||||
|
||||
@ -37,13 +38,8 @@ class InputPhoneContact:
|
||||
|
||||
__slots__ = []
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
phone: str,
|
||||
first_name: str,
|
||||
last_name: str = ""
|
||||
):
|
||||
pass
|
||||
def __init__(self, phone: str, first_name: str, last_name: str = ""):
|
||||
super().__init__(None)
|
||||
|
||||
def __new__(cls,
|
||||
phone: str,
|
||||
|
@ -26,7 +26,7 @@ from ...ext.utils import encode
|
||||
|
||||
|
||||
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:
|
||||
file_id (``str``):
|
||||
|
@ -26,7 +26,7 @@ from ..pyrogram_type import PyrogramType
|
||||
|
||||
|
||||
class Dialogs(PyrogramType):
|
||||
"""This object represents a user's dialogs chunk
|
||||
"""This object represents a user's dialogs chunk.
|
||||
|
||||
Args:
|
||||
total_count (``int``):
|
||||
|
Loading…
Reference in New Issue
Block a user