Skip to content

Commit cedb87e

Browse files
Тошаdelivrance
authored andcommitted
Add is_creator field to Chat object (pyrogram#306)
* Add is_creator field to Chat object * Update chat.py
1 parent 8b4dd1f commit cedb87e

File tree

1 file changed

+7
-0
lines changed
  • pyrogram/client/types/user_and_chats

1 file changed

+7
-0
lines changed

pyrogram/client/types/user_and_chats/chat.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class Chat(Object):
4444
True, if this chat has been restricted. Supergroups, channels and bots only.
4545
See *restriction_reason* for details.
4646
47+
is_creator (``bool``, *optional*):
48+
True, if this chat owner is the current user. Supergroups, channels and groups only.
49+
4750
is_scam (``bool``, *optional*):
4851
True, if this chat has been flagged for scam. Supergroups, channels and bots only.
4952
@@ -108,6 +111,7 @@ def __init__(
108111
type: str,
109112
is_verified: bool = None,
110113
is_restricted: bool = None,
114+
is_creator: bool = None,
111115
is_scam: bool = None,
112116
is_support: bool = None,
113117
title: str = None,
@@ -131,6 +135,7 @@ def __init__(
131135
self.type = type
132136
self.is_verified = is_verified
133137
self.is_restricted = is_restricted
138+
self.is_creator = is_creator
134139
self.is_scam = is_scam
135140
self.is_support = is_support
136141
self.title = title
@@ -175,6 +180,7 @@ def _parse_chat_chat(client, chat: types.Chat) -> "Chat":
175180
id=peer_id,
176181
type="group",
177182
title=chat.title,
183+
is_creator=getattr(channel, "creator", None),
178184
photo=ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
179185
permissions=ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
180186
members_count=getattr(chat, "participants_count", None),
@@ -191,6 +197,7 @@ def _parse_channel_chat(client, channel: types.Channel) -> "Chat":
191197
type="supergroup" if channel.megagroup else "channel",
192198
is_verified=getattr(channel, "verified", None),
193199
is_restricted=getattr(channel, "restricted", None),
200+
is_creator=getattr(channel, "creator", None),
194201
is_scam=getattr(channel, "scam", None),
195202
title=channel.title,
196203
username=getattr(channel, "username", None),

0 commit comments

Comments
 (0)