mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Some little fixes in case of ChatForbidden. Thanks @i-Naji
This commit is contained in:
parent
afc2a2e35d
commit
cd9f2223e7
@ -127,12 +127,17 @@ def parse_user_chat(user: types.User) -> pyrogram_types.Chat:
|
|||||||
|
|
||||||
|
|
||||||
def parse_chat_chat(chat: types.Chat) -> pyrogram_types.Chat:
|
def parse_chat_chat(chat: types.Chat) -> pyrogram_types.Chat:
|
||||||
|
admins_enabled = getattr(chat, "admins_enabled", None)
|
||||||
|
|
||||||
|
if admins_enabled is not None:
|
||||||
|
admins_enabled = not admins_enabled
|
||||||
|
|
||||||
return pyrogram_types.Chat(
|
return pyrogram_types.Chat(
|
||||||
id=-chat.id,
|
id=-chat.id,
|
||||||
type="group",
|
type="group",
|
||||||
title=chat.title,
|
title=chat.title,
|
||||||
all_members_are_administrators=not chat.admins_enabled,
|
all_members_are_administrators=admins_enabled,
|
||||||
photo=parse_chat_photo(chat.photo)
|
photo=parse_chat_photo(getattr(chat, "photo", None))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user