mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-23 18:37:26 +00:00
Merge branch 'master' into docs
This commit is contained in:
commit
02adcce597
@ -20,10 +20,10 @@ import sys
|
|||||||
|
|
||||||
__copyright__ = "Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>".replace(
|
__copyright__ = "Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>".replace(
|
||||||
"\xe8",
|
"\xe8",
|
||||||
"e" if sys.getfilesystemencoding() == "ascii" else "\xe8"
|
"e" if sys.getfilesystemencoding() != "utf-8" else "\xe8"
|
||||||
)
|
)
|
||||||
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
|
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
|
||||||
__version__ = "0.6.4"
|
__version__ = "0.6.5"
|
||||||
|
|
||||||
from .api.errors import Error
|
from .api.errors import Error
|
||||||
from .client import ChatAction
|
from .client import ChatAction
|
||||||
|
@ -45,11 +45,6 @@ from pyrogram.api.errors import (
|
|||||||
PasswordHashInvalid, FloodWait, PeerIdInvalid, FilePartMissing,
|
PasswordHashInvalid, FloodWait, PeerIdInvalid, FilePartMissing,
|
||||||
ChatAdminRequired, FirstnameInvalid, PhoneNumberBanned,
|
ChatAdminRequired, FirstnameInvalid, PhoneNumberBanned,
|
||||||
VolumeLocNotFound, UserMigrate)
|
VolumeLocNotFound, UserMigrate)
|
||||||
from pyrogram.api.types import (
|
|
||||||
User, Chat, Channel,
|
|
||||||
InputPeerEmpty, InputPeerSelf,
|
|
||||||
InputPeerUser, InputPeerChat, InputPeerChannel
|
|
||||||
)
|
|
||||||
from pyrogram.crypto import AES
|
from pyrogram.crypto import AES
|
||||||
from pyrogram.session import Auth, Session
|
from pyrogram.session import Auth, Session
|
||||||
from pyrogram.session.internals import MsgId
|
from pyrogram.session.internals import MsgId
|
||||||
@ -447,7 +442,7 @@ class Client:
|
|||||||
|
|
||||||
def fetch_peers(self, entities: list):
|
def fetch_peers(self, entities: list):
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
if isinstance(entity, User):
|
if isinstance(entity, types.User):
|
||||||
user_id = entity.id
|
user_id = entity.id
|
||||||
|
|
||||||
if user_id in self.peers_by_id:
|
if user_id in self.peers_by_id:
|
||||||
@ -461,7 +456,7 @@ class Client:
|
|||||||
username = entity.username
|
username = entity.username
|
||||||
phone = entity.phone
|
phone = entity.phone
|
||||||
|
|
||||||
input_peer = InputPeerUser(
|
input_peer = types.InputPeerUser(
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
access_hash=access_hash
|
access_hash=access_hash
|
||||||
)
|
)
|
||||||
@ -474,20 +469,20 @@ class Client:
|
|||||||
if phone is not None:
|
if phone is not None:
|
||||||
self.peers_by_phone[phone] = input_peer
|
self.peers_by_phone[phone] = input_peer
|
||||||
|
|
||||||
if isinstance(entity, Chat):
|
if isinstance(entity, types.Chat):
|
||||||
chat_id = entity.id
|
chat_id = entity.id
|
||||||
peer_id = -chat_id
|
peer_id = -chat_id
|
||||||
|
|
||||||
if peer_id in self.peers_by_id:
|
if peer_id in self.peers_by_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
input_peer = InputPeerChat(
|
input_peer = types.InputPeerChat(
|
||||||
chat_id=chat_id
|
chat_id=chat_id
|
||||||
)
|
)
|
||||||
|
|
||||||
self.peers_by_id[peer_id] = input_peer
|
self.peers_by_id[peer_id] = input_peer
|
||||||
|
|
||||||
if isinstance(entity, Channel):
|
if isinstance(entity, types.Channel):
|
||||||
channel_id = entity.id
|
channel_id = entity.id
|
||||||
peer_id = int("-100" + str(channel_id))
|
peer_id = int("-100" + str(channel_id))
|
||||||
|
|
||||||
@ -501,7 +496,7 @@ class Client:
|
|||||||
|
|
||||||
username = entity.username
|
username = entity.username
|
||||||
|
|
||||||
input_peer = InputPeerChannel(
|
input_peer = types.InputPeerChannel(
|
||||||
channel_id=channel_id,
|
channel_id=channel_id,
|
||||||
access_hash=access_hash
|
access_hash=access_hash
|
||||||
)
|
)
|
||||||
@ -651,6 +646,7 @@ class Client:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not isinstance(diff, types.updates.ChannelDifferenceEmpty):
|
||||||
updates.users += diff.users
|
updates.users += diff.users
|
||||||
updates.chats += diff.chats
|
updates.chats += diff.chats
|
||||||
|
|
||||||
@ -879,7 +875,7 @@ class Client:
|
|||||||
|
|
||||||
dialogs = self.send(
|
dialogs = self.send(
|
||||||
functions.messages.GetDialogs(
|
functions.messages.GetDialogs(
|
||||||
0, 0, InputPeerEmpty(),
|
0, 0, types.InputPeerEmpty(),
|
||||||
self.DIALOGS_AT_ONCE, True
|
self.DIALOGS_AT_ONCE, True
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -925,7 +921,7 @@ class Client:
|
|||||||
"""
|
"""
|
||||||
if type(peer_id) is str:
|
if type(peer_id) is str:
|
||||||
if peer_id in ("self", "me"):
|
if peer_id in ("self", "me"):
|
||||||
return InputPeerSelf()
|
return types.InputPeerSelf()
|
||||||
|
|
||||||
match = self.INVITE_LINK_RE.match(peer_id)
|
match = self.INVITE_LINK_RE.match(peer_id)
|
||||||
|
|
||||||
@ -981,7 +977,7 @@ class Client:
|
|||||||
"""
|
"""
|
||||||
return self.send(
|
return self.send(
|
||||||
functions.users.GetFullUser(
|
functions.users.GetFullUser(
|
||||||
InputPeerSelf()
|
types.InputPeerSelf()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2438,7 +2434,7 @@ class Client:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
channel = InputPeerChannel(
|
channel = types.InputPeerChannel(
|
||||||
channel_id=resolved_peer.chats[0].id,
|
channel_id=resolved_peer.chats[0].id,
|
||||||
access_hash=resolved_peer.chats[0].access_hash
|
access_hash=resolved_peer.chats[0].access_hash
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user