mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-04 22:34:52 +00:00
Fetch ChatForbidden and ChannelForbidden peers
This fixes unwanted PEER_ID_INVALID errors in cases where a user or a bot was kicked/banned from a group, supergroup or channel
This commit is contained in:
parent
4c9d9d84f2
commit
db6042e91b
1 changed files with 3 additions and 3 deletions
|
|
@ -615,7 +615,7 @@ class Client(Methods, BaseClient):
|
||||||
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, types.Chat):
|
if isinstance(entity, (types.Chat, types.ChatForbidden)):
|
||||||
chat_id = entity.id
|
chat_id = entity.id
|
||||||
peer_id = -chat_id
|
peer_id = -chat_id
|
||||||
|
|
||||||
|
|
@ -625,7 +625,7 @@ class Client(Methods, BaseClient):
|
||||||
|
|
||||||
self.peers_by_id[peer_id] = input_peer
|
self.peers_by_id[peer_id] = input_peer
|
||||||
|
|
||||||
if isinstance(entity, types.Channel):
|
if isinstance(entity, (types.Channel, types.ChannelForbidden)):
|
||||||
channel_id = entity.id
|
channel_id = entity.id
|
||||||
peer_id = int("-100" + str(channel_id))
|
peer_id = int("-100" + str(channel_id))
|
||||||
|
|
||||||
|
|
@ -634,7 +634,7 @@ class Client(Methods, BaseClient):
|
||||||
if access_hash is None:
|
if access_hash is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
username = entity.username
|
username = getattr(entity, "username", None)
|
||||||
|
|
||||||
input_peer = types.InputPeerChannel(
|
input_peer = types.InputPeerChannel(
|
||||||
channel_id=channel_id,
|
channel_id=channel_id,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue