From 390786d92ca0827d0318ae2af08afc3ff6f3fce7 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Mon, 9 Jun 2025 20:56:05 +0700 Subject: [PATCH] pyrofork: Add new ChatType (MONOFORUM) Signed-off-by: wulan17 --- pyrogram/enums/chat_type.py | 3 +++ pyrogram/types/user_and_chats/chat.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pyrogram/enums/chat_type.py b/pyrogram/enums/chat_type.py index 47d14f71..1b6ebe3c 100644 --- a/pyrogram/enums/chat_type.py +++ b/pyrogram/enums/chat_type.py @@ -39,3 +39,6 @@ class ChatType(AutoName): CHANNEL = auto() "Chat is a channel" + + MONOFORUM = auto() + "Chat is a monoforum" diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index 64acdb37..5395dc8b 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -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),