diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index ede69577a..e108f0577 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -552,6 +552,7 @@ def get_title_list(s: str) -> list: ForumTopicCreated ForumTopicEdited ForumTopicClosed + ForumTopicDeleted ForumTopicReopened GeneralTopicHidden GeneralTopicUnhidden diff --git a/pyrogram/types/user_and_chats/__init__.py b/pyrogram/types/user_and_chats/__init__.py index 77eb58457..9a992d55d 100644 --- a/pyrogram/types/user_and_chats/__init__.py +++ b/pyrogram/types/user_and_chats/__init__.py @@ -50,6 +50,7 @@ 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 @@ "ForumTopic", "ForumTopicCreated", "ForumTopicClosed", + "ForumTopicDeleted", "ForumTopicReopened", "ForumTopicEdited", "GeneralTopicHidden", diff --git a/pyrogram/types/user_and_chats/forum_topic.py b/pyrogram/types/user_and_chats/forum_topic.py index e8f01958a..86e951e56 100644 --- a/pyrogram/types/user_and_chats/forum_topic.py +++ b/pyrogram/types/user_and_chats/forum_topic.py @@ -123,7 +123,9 @@ def __init__( #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) diff --git a/pyrogram/types/user_and_chats/forum_topic_deleted.py b/pyrogram/types/user_and_chats/forum_topic_deleted.py new file mode 100644 index 000000000..c7402ad4f --- /dev/null +++ b/pyrogram/types/user_and_chats/forum_topic_deleted.py @@ -0,0 +1,45 @@ +# Pyrofork - Telegram MTProto API Client Library for Python +# Copyright (C) 2022-present 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 . + +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) + )