Skip to content

Commit

Permalink
pyrofork: Add ForumTopicDeleted
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <[email protected]>
  • Loading branch information
wulan17 committed Feb 6, 2025
1 parent c907513 commit 31be30b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ def get_title_list(s: str) -> list:
ForumTopicCreated
ForumTopicEdited
ForumTopicClosed
ForumTopicDeleted
ForumTopicReopened
GeneralTopicHidden
GeneralTopicUnhidden
Expand Down
2 changes: 2 additions & 0 deletions pyrogram/types/user_and_chats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,6 +89,7 @@
"ForumTopic",
"ForumTopicCreated",
"ForumTopicClosed",
"ForumTopicDeleted",
"ForumTopicReopened",
"ForumTopicEdited",
"GeneralTopicHidden",
Expand Down
4 changes: 3 additions & 1 deletion pyrogram/types/user_and_chats/forum_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
45 changes: 45 additions & 0 deletions pyrogram/types/user_and_chats/forum_topic_deleted.py
Original file line number Diff line number Diff line change
@@ -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)
)

0 comments on commit 31be30b

Please sign in to comment.