Skip to content

Commit 31be30b

Browse files
committed
pyrofork: Add ForumTopicDeleted
Signed-off-by: wulan17 <wulan17@nusantararom.org>
1 parent c907513 commit 31be30b

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

compiler/docs/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ def get_title_list(s: str) -> list:
552552
ForumTopicCreated
553553
ForumTopicEdited
554554
ForumTopicClosed
555+
ForumTopicDeleted
555556
ForumTopicReopened
556557
GeneralTopicHidden
557558
GeneralTopicUnhidden

pyrogram/types/user_and_chats/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from .forum_topic import ForumTopic
5151
from .forum_topic_created import ForumTopicCreated
5252
from .forum_topic_closed import ForumTopicClosed
53+
from .forum_topic_deleted import ForumTopicDeleted
5354
from .forum_topic_reopened import ForumTopicReopened
5455
from .forum_topic_edited import ForumTopicEdited
5556
from .general_forum_topic_hidden import GeneralTopicHidden
@@ -88,6 +89,7 @@
8889
"ForumTopic",
8990
"ForumTopicCreated",
9091
"ForumTopicClosed",
92+
"ForumTopicDeleted",
9193
"ForumTopicReopened",
9294
"ForumTopicEdited",
9395
"GeneralTopicHidden",

pyrogram/types/user_and_chats/forum_topic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def __init__(
123123
#self.draft = draft //todo
124124

125125
@staticmethod
126-
def _parse(forum_topic: "raw.types.forum_topic") -> "ForumTopic":
126+
def _parse(forum_topic: "raw.types.ForumTopic") -> "ForumTopic":
127+
if isinstance(forum_topic, raw.types.ForumTopicDeleted):
128+
return types.ForumTopicDeleted._parse(forum_topic)
127129
from_id = forum_topic.from_id
128130
if isinstance(from_id, raw.types.PeerChannel):
129131
peer = types.PeerChannel._parse(from_id)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Pyrofork - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
3+
#
4+
# This file is part of Pyrofork.
5+
#
6+
# Pyrofork is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrofork is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from pyrogram import raw, types
20+
from typing import Union
21+
from ..object import Object
22+
23+
24+
class ForumTopicDeleted(Object):
25+
"""A deleted forum topic.
26+
27+
Parameters:
28+
id (``Integer``):
29+
Id of the topic
30+
"""
31+
32+
def __init__(
33+
self,
34+
*,
35+
id: int
36+
):
37+
super().__init__()
38+
39+
self.id = id
40+
41+
@staticmethod
42+
def _parse(forum_topic: "raw.types.ForumTopicDeleted") -> "ForumTopicDeleted":
43+
return ForumTopicDeleted(
44+
id=getattr(forum_topic,"id", None)
45+
)

0 commit comments

Comments
 (0)