mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add ForumTopicDeleted
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
5350450f6c
commit
7faf2b45b5
4 changed files with 51 additions and 1 deletions
|
|
@ -553,6 +553,7 @@ def pyrogram_api():
|
|||
ForumTopicCreated
|
||||
ForumTopicEdited
|
||||
ForumTopicClosed
|
||||
ForumTopicDeleted
|
||||
ForumTopicReopened
|
||||
GeneralTopicHidden
|
||||
GeneralTopicUnhidden
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ from .username import Username
|
|||
from .forum_topic import ForumTopic
|
||||
from .forum_topic_created import ForumTopicCreated
|
||||
from .forum_topic_closed import ForumTopicClosed
|
||||
from .forum_topic_deleted import ForumTopicDeleted
|
||||
from .forum_topic_reopened import ForumTopicReopened
|
||||
from .forum_topic_edited import ForumTopicEdited
|
||||
from .general_forum_topic_hidden import GeneralTopicHidden
|
||||
|
|
@ -88,6 +89,7 @@ __all__ = [
|
|||
"ForumTopic",
|
||||
"ForumTopicCreated",
|
||||
"ForumTopicClosed",
|
||||
"ForumTopicDeleted",
|
||||
"ForumTopicReopened",
|
||||
"ForumTopicEdited",
|
||||
"GeneralTopicHidden",
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ class ForumTopic(Object):
|
|||
#self.draft = draft //todo
|
||||
|
||||
@staticmethod
|
||||
def _parse(forum_topic: "raw.types.forum_topic") -> "ForumTopic":
|
||||
def _parse(forum_topic: "raw.types.ForumTopic") -> "ForumTopic":
|
||||
if isinstance(forum_topic, raw.types.ForumTopicDeleted):
|
||||
return types.ForumTopicDeleted._parse(forum_topic)
|
||||
from_id = forum_topic.from_id
|
||||
if isinstance(from_id, raw.types.PeerChannel):
|
||||
peer = types.PeerChannel._parse(from_id)
|
||||
|
|
|
|||
45
pyrogram/types/user_and_chats/forum_topic_deleted.py
Normal file
45
pyrogram/types/user_and_chats/forum_topic_deleted.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrofork is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram import raw, types
|
||||
from typing import Union
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class ForumTopicDeleted(Object):
|
||||
"""A deleted forum topic.
|
||||
|
||||
Parameters:
|
||||
id (``Integer``):
|
||||
Id of the topic
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: int
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
self.id = id
|
||||
|
||||
@staticmethod
|
||||
def _parse(forum_topic: "raw.types.ForumTopicDeleted") -> "ForumTopicDeleted":
|
||||
return ForumTopicDeleted(
|
||||
id=getattr(forum_topic,"id", None)
|
||||
)
|
||||
Loading…
Reference in a new issue