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
28f7137828
commit
c7f7707fc6
2 changed files with 12 additions and 1 deletions
|
|
@ -39,3 +39,6 @@ class ChatType(AutoName):
|
||||||
|
|
||||||
CHANNEL = auto()
|
CHANNEL = auto()
|
||||||
"Chat is a channel"
|
"Chat is a channel"
|
||||||
|
|
||||||
|
MONOFORUM = auto()
|
||||||
|
"Chat is a monoforum"
|
||||||
|
|
|
||||||
|
|
@ -394,6 +394,14 @@ class Chat(Object):
|
||||||
restriction_reason = getattr(channel, "restriction_reason", [])
|
restriction_reason = getattr(channel, "restriction_reason", [])
|
||||||
user_name = getattr(channel, "username", None)
|
user_name = getattr(channel, "username", None)
|
||||||
active_usernames = getattr(channel, "usernames", [])
|
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
|
usernames = None
|
||||||
if len(active_usernames) >= 1:
|
if len(active_usernames) >= 1:
|
||||||
usernames = []
|
usernames = []
|
||||||
|
|
@ -410,7 +418,7 @@ class Chat(Object):
|
||||||
|
|
||||||
return Chat(
|
return Chat(
|
||||||
id=peer_id,
|
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_verified=getattr(channel, "verified", None),
|
||||||
is_restricted=getattr(channel, "restricted", None),
|
is_restricted=getattr(channel, "restricted", None),
|
||||||
is_creator=getattr(channel, "creator", None),
|
is_creator=getattr(channel, "creator", None),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue