pyrofork: Add new ChatType (MONOFORUM)

Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
wulan17 2025-06-09 20:56:05 +07:00
parent eb9954a5cf
commit a8a7bb5c03
No known key found for this signature in database
GPG key ID: 737814D4B5FF0420
2 changed files with 12 additions and 1 deletions

View file

@ -39,3 +39,6 @@ class ChatType(AutoName):
CHANNEL = auto()
"Chat is a channel"
MONOFORUM = auto()
"Chat is a monoforum"

View file

@ -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),