mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add new ChatType (MONOFORUM)
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
e5ccb0f36e
commit
c4fde1c6c9
2 changed files with 12 additions and 1 deletions
|
|
@ -39,3 +39,6 @@ class ChatType(AutoName):
|
|||
|
||||
CHANNEL = auto()
|
||||
"Chat is a channel"
|
||||
|
||||
MONOFORUM = auto()
|
||||
"Chat is a monoforum"
|
||||
|
|
|
|||
|
|
@ -394,6 +394,14 @@ class Chat(Object):
|
|||
restriction_reason = getattr(channel, "restriction_reason", [])
|
||||
user_name = getattr(channel, "username", None)
|
||||
active_usernames = getattr(channel, "usernames", [])
|
||||
if getattr(channel, "monoforum", None):
|
||||
chat_type = enums.ChatType.MONOFORUM
|
||||
elif getattr(channel, "megagroup", None):
|
||||
chat_type = enums.ChatType.SUPERGROUP
|
||||
elif getattr(channel, "broadcast", None):
|
||||
chat_type = enums.ChatType.CHANNEL
|
||||
else:
|
||||
chat_type = enums.ChatType.GROUP
|
||||
usernames = None
|
||||
if len(active_usernames) >= 1:
|
||||
usernames = []
|
||||
|
|
@ -410,7 +418,7 @@ class Chat(Object):
|
|||
|
||||
return Chat(
|
||||
id=peer_id,
|
||||
type=enums.ChatType.SUPERGROUP if getattr(channel, "megagroup", None) else enums.ChatType.CHANNEL,
|
||||
type=chat_type,
|
||||
is_verified=getattr(channel, "verified", None),
|
||||
is_restricted=getattr(channel, "restricted", None),
|
||||
is_creator=getattr(channel, "creator", None),
|
||||
|
|
|
|||
Loading…
Reference in a new issue