Added new filter

added new filter
This commit is contained in:
bakhrullo 2022-12-27 19:34:36 +03:00 committed by GitHub
parent ae534298e5
commit 809e6575f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -732,6 +732,23 @@ class ForwardedMessageFilter(BoundFilter):
async def check(self, message: Message):
return bool(getattr(message, "forward_date")) is self.is_forwarded
class IsReplyForwardedMessageFilter(BoundFilter):
key = 'is_reply_forwarded'
def __init__(self, is_is_reply_forwarded)
self.is_reply_forwarded = is_reply_forwarded
async def check(self, message: Message):
if message.reply_to_message and self.is_reply_forwarded:
if bool(getattr(message.reply_to_message, "forward_date")) is self.is_forwarded:
return {'reply': message.reply_to_message}
return False
elif not message.reply_to_message and not self.is_reply_forwarded:
if bool(getattr(message.reply_to_message, "forward_date")) is self.is_forwarded:
return True
return False
class ChatTypeFilter(BoundFilter):
key = 'chat_type'