mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Drop Chat.is_forum and add new ChatType (FORUM)
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
c7f7707fc6
commit
6835bccf11
4 changed files with 10 additions and 11 deletions
|
|
@ -40,5 +40,8 @@ class ChatType(AutoName):
|
||||||
CHANNEL = auto()
|
CHANNEL = auto()
|
||||||
"Chat is a channel"
|
"Chat is a channel"
|
||||||
|
|
||||||
|
FORUM = auto()
|
||||||
|
"Chat is a forum"
|
||||||
|
|
||||||
MONOFORUM = auto()
|
MONOFORUM = auto()
|
||||||
"Chat is a monoforum"
|
"Chat is a monoforum"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from pyrogram import raw, types
|
from pyrogram import enums, raw, types
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ class KeyboardButton(Object):
|
||||||
is_creator=b.peer_type.creator,
|
is_creator=b.peer_type.creator,
|
||||||
is_bot_participant=b.peer_type.bot_participant,
|
is_bot_participant=b.peer_type.bot_participant,
|
||||||
is_username=b.peer_type.has_username,
|
is_username=b.peer_type.has_username,
|
||||||
is_forum=b.peer_type.forum,
|
is_forum=True if b.peer_type.type == enums.ChatType.FORUM else False,
|
||||||
max=b.max_quantity
|
max=b.max_quantity
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -155,7 +155,7 @@ class KeyboardButton(Object):
|
||||||
creator=self.request_chat.is_creator,
|
creator=self.request_chat.is_creator,
|
||||||
bot_participant=self.request_chat.is_bot_participant,
|
bot_participant=self.request_chat.is_bot_participant,
|
||||||
has_username=self.request_chat.is_username,
|
has_username=self.request_chat.is_username,
|
||||||
forum=self.request_chat.is_forum
|
forum=True if self.request_chat.type == enums.ChatType.FORUM else False
|
||||||
),
|
),
|
||||||
max_quantity=self.request_chat.max,
|
max_quantity=self.request_chat.max,
|
||||||
name_requested=self.request_chat.is_name_requested,
|
name_requested=self.request_chat.is_name_requested,
|
||||||
|
|
|
||||||
|
|
@ -970,7 +970,7 @@ class Message(Object, Update):
|
||||||
else:
|
else:
|
||||||
parsed_message.message_thread_id = message.reply_to.reply_to_msg_id
|
parsed_message.message_thread_id = message.reply_to.reply_to_msg_id
|
||||||
parsed_message.is_topic_message = True
|
parsed_message.is_topic_message = True
|
||||||
elif parsed_message.chat.is_forum and parsed_message.message_thread_id is None:
|
elif parsed_message.chat.type == enums.ChatType.FORUM and parsed_message.message_thread_id is None:
|
||||||
parsed_message.message_thread_id = 1
|
parsed_message.message_thread_id = 1
|
||||||
parsed_message.is_topic_message = True
|
parsed_message.is_topic_message = True
|
||||||
|
|
||||||
|
|
@ -1299,7 +1299,7 @@ class Message(Object, Update):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
parsed_message.reply_to_story = reply_to_story
|
parsed_message.reply_to_story = reply_to_story
|
||||||
if parsed_message.chat.is_forum and parsed_message.message_thread_id is None:
|
if parsed_message.chat.type == enums.ChatType.FORUM and parsed_message.message_thread_id is None:
|
||||||
parsed_message.message_thread_id = 1
|
parsed_message.message_thread_id = 1
|
||||||
parsed_message.is_topic_message = True
|
parsed_message.is_topic_message = True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,6 @@ class Chat(Object):
|
||||||
is_support (``bool``):
|
is_support (``bool``):
|
||||||
True, if this chat is part of the Telegram support team. Users and bots only.
|
True, if this chat is part of the Telegram support team. Users and bots only.
|
||||||
|
|
||||||
is_forum (``bool``, *optional*):
|
|
||||||
True, if the supergroup chat is a forum
|
|
||||||
|
|
||||||
is_participants_hidden (``bool``, *optional*):
|
is_participants_hidden (``bool``, *optional*):
|
||||||
True, if the chat members are hidden.
|
True, if the chat members are hidden.
|
||||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||||
|
|
@ -231,7 +228,6 @@ class Chat(Object):
|
||||||
is_scam: bool = None,
|
is_scam: bool = None,
|
||||||
is_fake: bool = None,
|
is_fake: bool = None,
|
||||||
is_support: bool = None,
|
is_support: bool = None,
|
||||||
is_forum: bool = None,
|
|
||||||
is_participants_hidden: bool = None,
|
is_participants_hidden: bool = None,
|
||||||
is_join_request: bool = None,
|
is_join_request: bool = None,
|
||||||
is_join_to_send: bool = None,
|
is_join_to_send: bool = None,
|
||||||
|
|
@ -286,7 +282,6 @@ class Chat(Object):
|
||||||
self.is_scam = is_scam
|
self.is_scam = is_scam
|
||||||
self.is_fake = is_fake
|
self.is_fake = is_fake
|
||||||
self.is_support = is_support
|
self.is_support = is_support
|
||||||
self.is_forum = is_forum
|
|
||||||
self.is_participants_hidden = is_participants_hidden
|
self.is_participants_hidden = is_participants_hidden
|
||||||
self.is_join_request = is_join_request
|
self.is_join_request = is_join_request
|
||||||
self.is_join_to_send = is_join_to_send
|
self.is_join_to_send = is_join_to_send
|
||||||
|
|
@ -396,6 +391,8 @@ class Chat(Object):
|
||||||
active_usernames = getattr(channel, "usernames", [])
|
active_usernames = getattr(channel, "usernames", [])
|
||||||
if getattr(channel, "monoforum", None):
|
if getattr(channel, "monoforum", None):
|
||||||
chat_type = enums.ChatType.MONOFORUM
|
chat_type = enums.ChatType.MONOFORUM
|
||||||
|
elif getattr(channel, "forum", None):
|
||||||
|
chat_type = enums.ChatType.FORUM
|
||||||
elif getattr(channel, "megagroup", None):
|
elif getattr(channel, "megagroup", None):
|
||||||
chat_type = enums.ChatType.SUPERGROUP
|
chat_type = enums.ChatType.SUPERGROUP
|
||||||
elif getattr(channel, "broadcast", None):
|
elif getattr(channel, "broadcast", None):
|
||||||
|
|
@ -424,7 +421,6 @@ class Chat(Object):
|
||||||
is_creator=getattr(channel, "creator", None),
|
is_creator=getattr(channel, "creator", None),
|
||||||
is_scam=getattr(channel, "scam", None),
|
is_scam=getattr(channel, "scam", None),
|
||||||
is_fake=getattr(channel, "fake", None),
|
is_fake=getattr(channel, "fake", None),
|
||||||
is_forum=getattr(channel, "forum", None),
|
|
||||||
is_join_request=getattr(channel, "join_request", None),
|
is_join_request=getattr(channel, "join_request", None),
|
||||||
is_join_to_send=getattr(channel, "join_to_send", None),
|
is_join_to_send=getattr(channel, "join_to_send", None),
|
||||||
is_slowmode_enabled=getattr(channel, "slowmode_enabled", None),
|
is_slowmode_enabled=getattr(channel, "slowmode_enabled", None),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue