pyrofork: Add ForumTopicDeleted

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2025-02-06 15:56:20 +07:00
parent 5350450f6c
commit 7faf2b45b5
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
4 changed files with 51 additions and 1 deletions

View file

@ -553,6 +553,7 @@ def pyrogram_api():
ForumTopicCreated
ForumTopicEdited
ForumTopicClosed
ForumTopicDeleted
ForumTopicReopened
GeneralTopicHidden
GeneralTopicUnhidden

View file

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

View file

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

View 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)
)