From cedb87ef41105118006428966560b1668344df84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=BE=D1=88=D0=B0?= Date: Sat, 19 Oct 2019 18:35:26 +0400 Subject: [PATCH] Add is_creator field to Chat object (#306) * Add is_creator field to Chat object * Update chat.py --- pyrogram/client/types/user_and_chats/chat.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyrogram/client/types/user_and_chats/chat.py b/pyrogram/client/types/user_and_chats/chat.py index 80545446..15a4f8d6 100644 --- a/pyrogram/client/types/user_and_chats/chat.py +++ b/pyrogram/client/types/user_and_chats/chat.py @@ -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),