mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Fix promote_chat_member when adding bots as admins
This commit is contained in:
parent
97a4ddea27
commit
ce49fc38a0
1 changed files with 10 additions and 7 deletions
|
|
@ -19,7 +19,7 @@
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import raw, types
|
from pyrogram import raw, types, errors
|
||||||
|
|
||||||
|
|
||||||
class PromoteChatMember:
|
class PromoteChatMember:
|
||||||
|
|
@ -61,12 +61,15 @@ class PromoteChatMember:
|
||||||
if privileges is None:
|
if privileges is None:
|
||||||
privileges = types.ChatPrivileges()
|
privileges = types.ChatPrivileges()
|
||||||
|
|
||||||
raw_chat_member = (await self.invoke(
|
try:
|
||||||
raw.functions.channels.GetParticipant(
|
raw_chat_member = (await self.invoke(
|
||||||
channel=chat_id,
|
raw.functions.channels.GetParticipant(
|
||||||
participant=user_id
|
channel=chat_id,
|
||||||
)
|
participant=user_id
|
||||||
)).participant
|
)
|
||||||
|
)).participant
|
||||||
|
except errors.RPCError:
|
||||||
|
raw_chat_member = None
|
||||||
|
|
||||||
rank = None
|
rank = None
|
||||||
if isinstance(raw_chat_member, raw.types.ChannelParticipantAdmin):
|
if isinstance(raw_chat_member, raw.types.ChannelParticipantAdmin):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue