pyrofork: filters: topic: Add support for general topic

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2025-01-22 02:06:47 +07:00
parent a653065774
commit 885a832aa3
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -1081,6 +1081,7 @@ class topic(Filter, set):
Parameters:
topics (``int`` | ``list``):
Pass one or more topic ids to filter messages in specific topics.
Pass 1 for general topic.
Defaults to None (no topics).
"""
@ -1092,4 +1093,6 @@ class topic(Filter, set):
)
async def __call__(self, _, message: Message):
if message.is_topic_message and not message.topic:
return 1 in self
return message.topic and message.topic.id in self