mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Merge develop -> asyncio
This commit is contained in:
commit
c929ce3097
@ -125,6 +125,7 @@ WEBDOCUMENT_URL_INVALID The web document URL is invalid
|
|||||||
WEBDOCUMENT_MIME_INVALID The web document mime type is invalid
|
WEBDOCUMENT_MIME_INVALID The web document mime type is invalid
|
||||||
BUTTON_URL_INVALID The button url is invalid
|
BUTTON_URL_INVALID The button url is invalid
|
||||||
AUTH_BYTES_INVALID The authorization bytes are invalid
|
AUTH_BYTES_INVALID The authorization bytes are invalid
|
||||||
|
USER_ID_INVALID The user ID is invalid
|
||||||
CHANNELS_TOO_MUCH You have joined too many channels or supergroups
|
CHANNELS_TOO_MUCH You have joined too many channels or supergroups
|
||||||
ADMIN_RANK_INVALID The custom administrator title is invalid or is longer than 16 characters
|
ADMIN_RANK_INVALID The custom administrator title is invalid or is longer than 16 characters
|
||||||
ADMIN_RANK_EMOJI_NOT_ALLOWED Emojis are not allowed in custom administrator titles
|
ADMIN_RANK_EMOJI_NOT_ALLOWED Emojis are not allowed in custom administrator titles
|
||||||
|
|
@ -34,7 +34,8 @@ author = "Dan"
|
|||||||
extensions = [
|
extensions = [
|
||||||
"sphinx.ext.autodoc",
|
"sphinx.ext.autodoc",
|
||||||
"sphinx.ext.napoleon",
|
"sphinx.ext.napoleon",
|
||||||
"sphinx.ext.autosummary"
|
"sphinx.ext.autosummary",
|
||||||
|
"sphinx_copybutton"
|
||||||
]
|
]
|
||||||
|
|
||||||
master_doc = "index"
|
master_doc = "index"
|
||||||
|
@ -1232,6 +1232,7 @@ class Client(Methods, BaseClient):
|
|||||||
access_hash=data.access_hash,
|
access_hash=data.access_hash,
|
||||||
thumb_size=data.thumb_size,
|
thumb_size=data.thumb_size,
|
||||||
peer_id=data.peer_id,
|
peer_id=data.peer_id,
|
||||||
|
peer_type=data.peer_type,
|
||||||
peer_access_hash=data.peer_access_hash,
|
peer_access_hash=data.peer_access_hash,
|
||||||
volume_id=data.volume_id,
|
volume_id=data.volume_id,
|
||||||
local_id=data.local_id,
|
local_id=data.local_id,
|
||||||
@ -1889,6 +1890,7 @@ class Client(Methods, BaseClient):
|
|||||||
access_hash: int,
|
access_hash: int,
|
||||||
thumb_size: str,
|
thumb_size: str,
|
||||||
peer_id: int,
|
peer_id: int,
|
||||||
|
peer_type: str,
|
||||||
peer_access_hash: int,
|
peer_access_hash: int,
|
||||||
volume_id: int,
|
volume_id: int,
|
||||||
local_id: int,
|
local_id: int,
|
||||||
@ -1936,11 +1938,23 @@ class Client(Methods, BaseClient):
|
|||||||
file_ref = utils.decode_file_ref(file_ref)
|
file_ref = utils.decode_file_ref(file_ref)
|
||||||
|
|
||||||
if media_type == 1:
|
if media_type == 1:
|
||||||
location = types.InputPeerPhotoFileLocation(
|
if peer_type == "user":
|
||||||
peer=types.InputPeerUser(
|
peer = types.InputPeerUser(
|
||||||
user_id=peer_id,
|
user_id=peer_id,
|
||||||
access_hash=peer_access_hash
|
access_hash=peer_access_hash
|
||||||
),
|
)
|
||||||
|
elif peer_type == "chat":
|
||||||
|
peer = types.InputPeerChat(
|
||||||
|
chat_id=peer_id
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
peer = types.InputPeerChannel(
|
||||||
|
channel_id=peer_id,
|
||||||
|
access_hash=peer_access_hash
|
||||||
|
)
|
||||||
|
|
||||||
|
location = types.InputPeerPhotoFileLocation(
|
||||||
|
peer=peer,
|
||||||
volume_id=volume_id,
|
volume_id=volume_id,
|
||||||
local_id=local_id,
|
local_id=local_id,
|
||||||
big=is_big or None
|
big=is_big or None
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
class FileData:
|
class FileData:
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *, media_type: int = None, dc_id: int = None, document_id: int = None, access_hash: int = None,
|
self, *, media_type: int = None, dc_id: int = None, document_id: int = None, access_hash: int = None,
|
||||||
thumb_size: str = None, peer_id: int = None, peer_access_hash: int = None, volume_id: int = None,
|
thumb_size: str = None, peer_id: int = None, peer_type: str = None, peer_access_hash: int = None,
|
||||||
local_id: int = None, is_big: bool = None, file_size: int = None, mime_type: str = None, file_name: str = None,
|
volume_id: int = None, local_id: int = None, is_big: bool = None, file_size: int = None, mime_type: str = None,
|
||||||
date: int = None, file_ref: str = None
|
file_name: str = None, date: int = None, file_ref: str = None
|
||||||
):
|
):
|
||||||
self.media_type = media_type
|
self.media_type = media_type
|
||||||
self.dc_id = dc_id
|
self.dc_id = dc_id
|
||||||
@ -30,6 +30,7 @@ class FileData:
|
|||||||
self.access_hash = access_hash
|
self.access_hash = access_hash
|
||||||
self.thumb_size = thumb_size
|
self.thumb_size = thumb_size
|
||||||
self.peer_id = peer_id
|
self.peer_id = peer_id
|
||||||
|
self.peer_type = peer_type
|
||||||
self.peer_access_hash = peer_access_hash
|
self.peer_access_hash = peer_access_hash
|
||||||
self.volume_id = volume_id
|
self.volume_id = volume_id
|
||||||
self.local_id = local_id
|
self.local_id = local_id
|
||||||
|
@ -147,13 +147,23 @@ class DownloadMedia(BaseClient):
|
|||||||
|
|
||||||
if media_type == 1:
|
if media_type == 1:
|
||||||
unpacked = struct.unpack("<iiqqqiiiqi", decoded)
|
unpacked = struct.unpack("<iiqqqiiiqi", decoded)
|
||||||
dc_id, photo_id, _, volume_id, size_type, peer_id, _, peer_access_hash, local_id = unpacked[1:]
|
dc_id, photo_id, _, volume_id, size_type, peer_id, x, peer_access_hash, local_id = unpacked[1:]
|
||||||
|
|
||||||
|
if x == 0:
|
||||||
|
peer_type = "user"
|
||||||
|
elif x == -1:
|
||||||
|
peer_id = -peer_id
|
||||||
|
peer_type = "chat"
|
||||||
|
else:
|
||||||
|
peer_id = utils.get_channel_id(peer_id - 1000727379968)
|
||||||
|
peer_type = "channel"
|
||||||
|
|
||||||
data = FileData(
|
data = FileData(
|
||||||
**get_existing_attributes(),
|
**get_existing_attributes(),
|
||||||
media_type=media_type,
|
media_type=media_type,
|
||||||
dc_id=dc_id,
|
dc_id=dc_id,
|
||||||
peer_id=peer_id,
|
peer_id=peer_id,
|
||||||
|
peer_type=peer_type,
|
||||||
peer_access_hash=peer_access_hash,
|
peer_access_hash=peer_access_hash,
|
||||||
volume_id=volume_id,
|
volume_id=volume_id,
|
||||||
local_id=local_id,
|
local_id=local_id,
|
||||||
|
@ -27,6 +27,6 @@ class List(list):
|
|||||||
return Object.__str__(self)
|
return Object.__str__(self)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "pyrogram.client.types.pyrogram_list.PyrogramList([{}])".format(
|
return "pyrogram.client.types.list.List([{}])".format(
|
||||||
",".join(Object.__repr__(i) for i in self)
|
",".join(Object.__repr__(i) for i in self)
|
||||||
)
|
)
|
||||||
|
@ -44,6 +44,9 @@ class Chat(Object):
|
|||||||
True, if this chat has been restricted. Supergroups, channels and bots only.
|
True, if this chat has been restricted. Supergroups, channels and bots only.
|
||||||
See *restriction_reason* for details.
|
See *restriction_reason* for details.
|
||||||
|
|
||||||
|
is_creator (``bool``, *optional*):
|
||||||
|
True, if this chat owner is the current user. Supergroups, channels and groups only.
|
||||||
|
|
||||||
is_scam (``bool``, *optional*):
|
is_scam (``bool``, *optional*):
|
||||||
True, if this chat has been flagged for scam. Supergroups, channels and bots only.
|
True, if this chat has been flagged for scam. Supergroups, channels and bots only.
|
||||||
|
|
||||||
@ -108,6 +111,7 @@ class Chat(Object):
|
|||||||
type: str,
|
type: str,
|
||||||
is_verified: bool = None,
|
is_verified: bool = None,
|
||||||
is_restricted: bool = None,
|
is_restricted: bool = None,
|
||||||
|
is_creator: bool = None,
|
||||||
is_scam: bool = None,
|
is_scam: bool = None,
|
||||||
is_support: bool = None,
|
is_support: bool = None,
|
||||||
title: str = None,
|
title: str = None,
|
||||||
@ -131,6 +135,7 @@ class Chat(Object):
|
|||||||
self.type = type
|
self.type = type
|
||||||
self.is_verified = is_verified
|
self.is_verified = is_verified
|
||||||
self.is_restricted = is_restricted
|
self.is_restricted = is_restricted
|
||||||
|
self.is_creator = is_creator
|
||||||
self.is_scam = is_scam
|
self.is_scam = is_scam
|
||||||
self.is_support = is_support
|
self.is_support = is_support
|
||||||
self.title = title
|
self.title = title
|
||||||
@ -175,6 +180,7 @@ class Chat(Object):
|
|||||||
id=peer_id,
|
id=peer_id,
|
||||||
type="group",
|
type="group",
|
||||||
title=chat.title,
|
title=chat.title,
|
||||||
|
is_creator=getattr(chat, "creator", None),
|
||||||
photo=ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
|
photo=ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
|
||||||
permissions=ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
|
permissions=ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
|
||||||
members_count=getattr(chat, "participants_count", None),
|
members_count=getattr(chat, "participants_count", None),
|
||||||
@ -191,6 +197,7 @@ class Chat(Object):
|
|||||||
type="supergroup" if channel.megagroup else "channel",
|
type="supergroup" if channel.megagroup else "channel",
|
||||||
is_verified=getattr(channel, "verified", None),
|
is_verified=getattr(channel, "verified", None),
|
||||||
is_restricted=getattr(channel, "restricted", None),
|
is_restricted=getattr(channel, "restricted", None),
|
||||||
|
is_creator=getattr(channel, "creator", None),
|
||||||
is_scam=getattr(channel, "scam", None),
|
is_scam=getattr(channel, "scam", None),
|
||||||
title=channel.title,
|
title=channel.title,
|
||||||
username=getattr(channel, "username", None),
|
username=getattr(channel, "username", None),
|
||||||
|
@ -55,7 +55,7 @@ class ChatPhoto(Object):
|
|||||||
if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)):
|
if not isinstance(chat_photo, (types.UserProfilePhoto, types.ChatPhoto)):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not peer_access_hash:
|
if peer_access_hash is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
photo_id = getattr(chat_photo, "photo_id", 0)
|
photo_id = getattr(chat_photo, "photo_id", 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user