2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +00:00

Add is_creator field to Chat object (#306)

* Add is_creator field to Chat object

* Update chat.py
This commit is contained in:
Тоша 2019-10-19 18:35:26 +04:00 committed by Dan
parent 8b4dd1fa4a
commit cedb87ef41

View File

@ -44,6 +44,9 @@ class Chat(Object):
True, if this chat has been restricted. Supergroups, channels and bots only.
See *restriction_reason* for details.
is_creator (``bool``, *optional*):
True, if this chat owner is the current user. Supergroups, channels and groups only.
is_scam (``bool``, *optional*):
True, if this chat has been flagged for scam. Supergroups, channels and bots only.
@ -108,6 +111,7 @@ class Chat(Object):
type: str,
is_verified: bool = None,
is_restricted: bool = None,
is_creator: bool = None,
is_scam: bool = None,
is_support: bool = None,
title: str = None,
@ -131,6 +135,7 @@ class Chat(Object):
self.type = type
self.is_verified = is_verified
self.is_restricted = is_restricted
self.is_creator = is_creator
self.is_scam = is_scam
self.is_support = is_support
self.title = title
@ -175,6 +180,7 @@ class Chat(Object):
id=peer_id,
type="group",
title=chat.title,
is_creator=getattr(channel, "creator", None),
photo=ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
permissions=ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
members_count=getattr(chat, "participants_count", None),
@ -191,6 +197,7 @@ class Chat(Object):
type="supergroup" if channel.megagroup else "channel",
is_verified=getattr(channel, "verified", None),
is_restricted=getattr(channel, "restricted", None),
is_creator=getattr(channel, "creator", None),
is_scam=getattr(channel, "scam", None),
title=channel.title,
username=getattr(channel, "username", None),