2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Fix promote_chat_member when adding bots as admins

This commit is contained in:
Dan 2022-05-06 22:00:20 +02:00
parent 97a4ddea27
commit ce49fc38a0

View File

@ -19,7 +19,7 @@
from typing import Union
import pyrogram
from pyrogram import raw, types
from pyrogram import raw, types, errors
class PromoteChatMember:
@ -61,12 +61,15 @@ class PromoteChatMember:
if privileges is None:
privileges = types.ChatPrivileges()
try:
raw_chat_member = (await self.invoke(
raw.functions.channels.GetParticipant(
channel=chat_id,
participant=user_id
)
)).participant
except errors.RPCError:
raw_chat_member = None
rank = None
if isinstance(raw_chat_member, raw.types.ChannelParticipantAdmin):