Pyrofork: Add support for t.me/<username> link in resolve_peer method

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-01-04 04:04:24 +07:00
parent e9f3677908
commit 48c7a5e2f9
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
128 changed files with 169 additions and 6 deletions

View file

@ -47,7 +47,7 @@ class ResolvePeer:
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).
Can be a direct id (int), a username (str) or a phone number (str) or *t.me/<username>* link.
Returns:
``InputPeer``: On success, the resolved peer id is returned in form of an InputPeer object.
@ -66,6 +66,7 @@ class ResolvePeer:
return raw.types.InputPeerSelf()
peer_id = re.sub(r"[@+\s]", "", peer_id.lower())
peer_id = re.sub(r"https://t.me/", "", peer_id.lower())
try:
int(peer_id)

View file

@ -35,6 +35,7 @@ class GetChatMenuButton:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use user profile/chat public link in form of *t.me/<username>* (str).
If not specified, default bot's menu button will be returned.
"""

View file

@ -39,6 +39,7 @@ class GetGameHighScores:
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).
You can also use user profile link in form of *t.me/<username>* (str).
chat_id (``int`` | ``str``, *optional*):
Unique identifier (int) or username (str) of the target chat.

View file

@ -41,6 +41,7 @@ class GetInlineBotResults:
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).
You can also use bot profile link in form of *t.me/<username>* (str).
query (``str``, *optional*):
Text of the query (up to 512 characters).

View file

@ -40,6 +40,7 @@ class RequestCallbackAnswer:
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).
You can also use user profile/chat public link in form of *t.me/<username>* (str).
message_id (``int``):
The message id the inline keyboard is attached on.

View file

@ -49,6 +49,7 @@ class SendGame:
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).
You can also use user profile/chat public link in form of *t.me/<username>* (str).
game_short_name (``str``):
Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.

View file

@ -46,6 +46,7 @@ class SendInlineBotResult:
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).
You can also use user profile/chat public link in form of *t.me/<username>* (str).
query_id (``int``):
Unique identifier for the answered query.

View file

@ -43,6 +43,7 @@ class SetGameScore:
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).
You can also use user profile link in form of *t.me/<username>* (str).
score (``int``):
New score, must be non-negative.

View file

@ -35,12 +35,13 @@ class AddChatMembers:
Parameters:
chat_id (``int`` | ``str``):
The group, supergroup or channel id
The group, supergroup or channel id or chat/channel public link
user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
Users to add in the chat
You can pass an ID (int), username (str) or phone number (str).
Multiple users can be added by passing a list of IDs, usernames or phone numbers.
You can also use user profile link in form of *t.me/<username>* (str).
forward_limit (``int``, *optional*):
How many of the latest messages you want to forward to the new members. Pass 0 to forward none of them.

View file

@ -35,6 +35,7 @@ class ArchiveChats:
chat_ids (``int`` | ``str`` | List[``int``, ``str``]):
Unique identifier (int) or username (str) of the target chat.
You can also pass a list of ids (int) or usernames (str).
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, True is returned.

View file

@ -46,10 +46,12 @@ class BanChatMember:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
until_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the user will be unbanned.

View file

@ -34,6 +34,7 @@ class CloseForumTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
topic_id (``int``):
Unique identifier (int) of the target forum topic.

View file

@ -33,6 +33,7 @@ class CloseGeneralTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
`bool`: On success, a True is returned.

View file

@ -36,6 +36,7 @@ class CreateForumTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
title (``str``):
The forum topic title.

View file

@ -34,6 +34,7 @@ class DeleteChannel:
Parameters:
chat_id (``int`` | ``str``):
The id of the channel to be deleted.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, True is returned.

View file

@ -36,6 +36,7 @@ class DeleteChatPhoto:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: True on success.

View file

@ -34,6 +34,7 @@ class DeleteForumTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
topic_id (``int``):
Unique identifier (int) of the target forum topic.

View file

@ -34,6 +34,7 @@ class DeleteSupergroup:
Parameters:
chat_id (``int`` | ``str``):
The id of the supergroup to be deleted.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, True is returned.

View file

@ -35,9 +35,11 @@ class DeleteUserHistory:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the user whose messages will be deleted.
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
``bool``: True on success, False otherwise.

View file

@ -36,6 +36,7 @@ class EditForumTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
topic_id (``int``):
Unique identifier (int) of the target forum topic.

View file

@ -34,6 +34,7 @@ class EditGeneralTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
title (``str``):
The general forum topic title.

View file

@ -39,8 +39,9 @@ class GetChat:
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).
Unique identifier for the target chat in form of a *t.me/joinchat/* or *t.me/<username>* link link,
identifier (int) or username of the target channel/supergroup (in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
:obj:`~pyrogram.types.Chat` | :obj:`~pyrogram.types.ChatPreview`: On success, if you've already joined the chat, a chat object is returned,

View file

@ -43,6 +43,7 @@ class GetChatEventLog:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
query (``str``, *optional*):
Search query to filter events based on text.

View file

@ -37,11 +37,13 @@ class GetChatMember:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``)::
Unique identifier (int) or username (str) of the target user.
For you yourself you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
:obj:`~pyrogram.types.ChatMember`: On success, a chat member is returned.

View file

@ -75,6 +75,7 @@ class GetChatMembers:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
query (``str``, *optional*):
Query string to filter members based on their display names and usernames.

View file

@ -34,6 +34,7 @@ class GetChatMembersCount:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``int``: On success, the chat members count is returned.

View file

@ -34,6 +34,7 @@ class GetChatOnlineCount:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``int``: On success, the chat members online count is returned.

View file

@ -41,6 +41,7 @@ class GetForumTopics:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
limit (``int``, *optional*):
Limits the number of topics to be retrieved.

View file

@ -41,6 +41,7 @@ class GetForumTopicsByID:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
topic_ids (``int`` | Iterable of ``int``, *optional*):
Pass a single topic identifier or an iterable of topic ids (as integers) to get the information of the

View file

@ -35,6 +35,7 @@ class GetSendAsChats:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
List[:obj:`~pyrogram.types.Chat`]: The list of chats.

View file

@ -33,6 +33,7 @@ class HideGeneralTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
`bool`: On success, a True is returned.

View file

@ -34,8 +34,8 @@ class JoinChat:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier for the target chat in form of a *t.me/joinchat/* link, a username of the target
channel/supergroup (in the format @username) or a chat id of a linked chat (channel or supergroup).
Unique identifier for the target chat in form of a *t.me/joinchat/* or *t.me/<username>* link,
a username of the target channel/supergroup (in the format @username) or a chat id of a linked chat (channel or supergroup).
Returns:
:obj:`~pyrogram.types.Chat`: On success, a chat object is returned.

View file

@ -36,6 +36,7 @@ class LeaveChat:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
delete (``bool``, *optional*):
Deletes the group chat dialog after leaving (for simple group chats, not supergroups).

View file

@ -34,6 +34,7 @@ class MarkChatUnread:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, True is returned.

View file

@ -39,6 +39,7 @@ class PinChatMessage:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Identifier of a message to pin.

View file

@ -40,10 +40,12 @@ class PromoteChatMember:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*):
New user privileges.

View file

@ -34,6 +34,7 @@ class ReopenForumTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
topic_id (``int``):
Unique identifier (int) of the target forum topic.

View file

@ -33,6 +33,7 @@ class ReopenGeneralTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
`bool`: On success, a True is returned.

View file

@ -43,10 +43,12 @@ class RestrictChatMember:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
permissions (:obj:`~pyrogram.types.ChatPermissions`):
New user permissions.

View file

@ -39,10 +39,12 @@ class SetAdministratorTitle:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
title (``str``, *optional*):
A custom title that will be shown to all members instead of "Owner" or "Admin".

View file

@ -36,6 +36,7 @@ class SetChatDescription:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
description (``str``):
New chat description, 0-255 characters.

View file

@ -40,6 +40,7 @@ class SetChatPermissions:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
permissions (:obj:`~pyrogram.types.ChatPermissions`):
New default chat permissions.

View file

@ -46,6 +46,7 @@ class SetChatPhoto:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
photo (``str`` | ``BinaryIO``, *optional*):
New chat photo. You can pass a :obj:`~pyrogram.types.Photo` file_id, a file path to upload a new photo

View file

@ -35,6 +35,7 @@ class SetChatProtectedContent:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
enabled (``bool``):
Pass True to enable the protected content setting, False to disable.

View file

@ -41,6 +41,7 @@ class SetChatTitle:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
title (``str``):
New chat title, 1-255 characters.

View file

@ -37,6 +37,7 @@ class SetChatUsername:
Parameters:
chat_id (``int`` | ``str``)
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
username (``str`` | ``None``):
Username to set. Pass "" (empty string) or None to remove the username.

View file

@ -37,9 +37,11 @@ class SetSendAsChat:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
send_as_chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the send_as chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, true is returned

View file

@ -35,6 +35,7 @@ class SetSlowMode:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
seconds (``int`` | ``None``):
Seconds in which members will be able to send only one message per this interval.

View file

@ -35,6 +35,7 @@ class UnarchiveChats:
chat_ids (``int`` | ``str`` | List[``int``, ``str``]):
Unique identifier (int) or username (str) of the target chat.
You can also pass a list of ids (int) or usernames (str).
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: On success, True is returned.

View file

@ -37,6 +37,7 @@ class UnbanChatMember:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.

View file

@ -33,6 +33,7 @@ class UnhideGeneralTopic:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
`bool`: On success, a True is returned.

View file

@ -36,6 +36,7 @@ class UnpinAllChatMessages:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``bool``: True on success.

View file

@ -37,6 +37,7 @@ class UnpinChatMessage:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``, *optional*):
Identifier of a message to unpin.

View file

@ -36,6 +36,7 @@ class UpdateColor:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
color (:obj:`~pyrogram.enums.ReplyColor` | :obj:`~pyrogram.enums.ProfileColor`):
Color type.

View file

@ -39,6 +39,7 @@ class AddContact:
Parameters:
user_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
You can also use user profile link in form of *t.me/<username>* (str).
first_name (``str``):
User's first name.

View file

@ -34,6 +34,7 @@ class DeleteContacts:
Parameters:
user_ids (``int`` | ``str`` | List of ``int`` or ``str``):
A single user id/username or a list of user identifiers (id or username).
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
:obj:`~pyrogram.types.User` | List of :obj:`~pyrogram.types.User` | ``None``: In case *user_ids* was an

View file

@ -36,6 +36,7 @@ class ApproveAllChatJoinRequests:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (``str``, *optional*):
Pass an invite link to approve only its join requests.

View file

@ -39,9 +39,11 @@ class ApproveChatJoinRequest:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int``):
Unique identifier of the target user.
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
``bool``: True on success.

View file

@ -45,6 +45,7 @@ class CreateChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
name (``str``, *optional*):
Invite link name.

View file

@ -36,6 +36,7 @@ class DeclineAllChatJoinRequests:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (``str``, *optional*):
Pass an invite link to decline only its join requests.

View file

@ -39,9 +39,11 @@ class DeclineChatJoinRequest:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
user_id (``int``):
Unique identifier of the target user.
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
``bool``: True on success.

View file

@ -36,11 +36,13 @@ class DeleteChatAdminInviteLinks:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
admin_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For you yourself you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
Returns:
``bool``: On success ``True`` is returned.

View file

@ -36,6 +36,7 @@ class DeleteChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (``str``):
The revoked invite link to delete.

View file

@ -44,6 +44,7 @@ class EditChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (``str``):
The invite link to edit

View file

@ -45,6 +45,7 @@ class ExportChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``str``: On success, the new invite link as string is returned.

View file

@ -44,11 +44,13 @@ class GetChatAdminInviteLinks:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
admin_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For you yourself you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
revoked (``bool``, *optional*):
True, if you want to get revoked links instead.

View file

@ -37,11 +37,13 @@ class GetChatAdminInviteLinksCount:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
admin_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target user.
For you yourself you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use user profile link in form of *t.me/<username>* (str).
revoked (``bool``, *optional*):
True, if you want to get revoked links instead.

View file

@ -37,6 +37,7 @@ class GetChatAdminsWithInviteLinks:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
List of :obj:`~pyrogram.types.ChatAdminWithInviteLink`: On success, the list of admins that have exported

View file

@ -37,6 +37,7 @@ class GetChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (str):
The invite link.

View file

@ -38,6 +38,7 @@ class GetChatInviteLinkJoiners:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (str):
The invite link.

View file

@ -36,6 +36,7 @@ class GetChatInviteLinkJoinersCount:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (str):
The invite link.

View file

@ -38,6 +38,7 @@ class GetChatJoinRequests:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
limit (``int``, *optional*):
Limits the number of invite links to be retrieved.

View file

@ -41,6 +41,7 @@ class RevokeChatInviteLink:
chat_id (``int`` | ``str``):
Unique identifier for the target chat or username of the target channel/supergroup
(in the format @username).
You can also use chat public link in form of *t.me/<username>* (str).
invite_link (``str``):
The invite link to revoke.

View file

@ -49,11 +49,13 @@ class CopyMediaGroup:
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).
You can also use chat public link in form of *t.me/<username>* (str).
from_chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the source chat where the original media group was sent.
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in *from_chat_id*.

View file

@ -61,11 +61,13 @@ class CopyMessage:
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).
You can also use chat public link in form of *t.me/<username>* (str).
from_chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the source chat where the original message was sent.
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in *from_chat_id*.

View file

@ -38,6 +38,7 @@ class DeleteMessages:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_ids (``int`` | Iterable of ``int``):
An iterable of message identifiers to delete (integers) or a single message id.

View file

@ -41,6 +41,7 @@ class EditMessageCaption:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in chat_id.

View file

@ -49,6 +49,7 @@ class EditMessageMedia:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in chat_id.

View file

@ -39,6 +39,7 @@ class EditMessageReplyMarkup:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in chat_id.

View file

@ -44,6 +44,7 @@ class EditMessageText:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message identifier in the chat specified in chat_id.

View file

@ -46,11 +46,13 @@ class ForwardMessages:
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).
You can also use chat public link in form of *t.me/<username>* (str).
from_chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the source chat where the original message was sent.
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_ids (``int`` | Iterable of ``int``):
An iterable of message identifiers in the chat specified in *from_chat_id* or a single message id.

View file

@ -74,6 +74,7 @@ class GetChatHistory:
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).
You can also use chat public link in form of *t.me/<username>* (str).
limit (``int``, *optional*):
Limits the number of messages to be retrieved.

View file

@ -43,6 +43,7 @@ class GetChatHistoryCount:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
Returns:
``int``: On success, the chat history count is returned.

View file

@ -39,6 +39,7 @@ class GetDiscussionMessage:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message id.

View file

@ -36,6 +36,7 @@ class GetDiscussionReplies:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message id.

View file

@ -35,6 +35,7 @@ class GetDiscussionRepliesCount:
Parameters:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Message id.

View file

@ -40,6 +40,7 @@ class GetMediaGroup:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
The id of one of the messages that belong to the media group.

View file

@ -49,6 +49,7 @@ class GetMessages:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_ids (``int`` | Iterable of ``int``, *optional*):
Pass a single message identifier or an iterable of message ids (as integers) to get the content of the

View file

@ -37,6 +37,7 @@ class ReadChatHistory:
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).
You can also use chat public link in form of *t.me/<username>* (str).
max_id (``int``, *optional*):
The id of the last message you want to mark as read; all the messages before this one will be marked as

View file

@ -38,6 +38,7 @@ class RetractVote:
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).
You can also use chat public link in form of *t.me/<username>* (str).
message_id (``int``):
Identifier of the original message with the poll.

View file

@ -79,6 +79,7 @@ class SearchMessages:
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).
You can also use chat public link in form of *t.me/<username>* (str).
query (``str``, *optional*):
Text query string.

View file

@ -41,6 +41,7 @@ class SearchMessagesCount:
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).
You can also use chat public link in form of *t.me/<username>* (str).
query (``str``, *optional*):
Text query string.

View file

@ -73,6 +73,7 @@ class SendAnimation:
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).
You can also use chat public link in form of *t.me/<username>* (str).
animation (``str`` | ``BinaryIO``):
Animation to send.
@ -134,6 +135,7 @@ class SendAnimation:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -73,6 +73,7 @@ class SendAudio:
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).
You can also use chat public link in form of *t.me/<username>* (str).
audio (``str`` | ``BinaryIO``):
Audio file to send.
@ -127,6 +128,7 @@ class SendAudio:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -64,6 +64,7 @@ class SendCachedMedia:
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).
You can also use chat public link in form of *t.me/<username>* (str).
file_id (``str``):
Media to send.
@ -99,6 +100,7 @@ class SendCachedMedia:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -39,6 +39,7 @@ class SendChatAction:
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).
You can also use chat public link in form of *t.me/<username>* (str).
action (:obj:`~pyrogram.enums.ChatAction`):
Type of action to broadcast.

View file

@ -58,6 +58,7 @@ class SendContact:
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).
You can also use chat public link in form of *t.me/<username>* (str).
phone_number (``str``):
Contact's phone number.
@ -85,6 +86,7 @@ class SendContact:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -56,6 +56,7 @@ class SendDice:
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).
You can also use chat public link in form of *t.me/<username>* (str).
emoji (``str``, *optional*):
Emoji on which the dice throw animation is based.
@ -81,6 +82,7 @@ class SendDice:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -69,6 +69,7 @@ class SendDocument:
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).
You can also use chat public link in form of *t.me/<username>* (str).
document (``str`` | ``BinaryIO``):
File to send.
@ -119,6 +120,7 @@ class SendDocument:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
quote_text (``str``, *optional*):
Text to quote.

View file

@ -56,6 +56,7 @@ class SendLocation:
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).
You can also use chat public link in form of *t.me/<username>* (str).
latitude (``float``):
Latitude of the location.
@ -74,6 +75,7 @@ class SendLocation:
reply_to_chat_id (``int`` | ``str``, *optional*):
Unique identifier for the origin chat.
for reply to message from another chat.
You can also use chat public link in form of *t.me/<username>* (str).
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message

Some files were not shown because too many files have changed in this diff Show more