forked from Djaler/ZloyBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilters.py
More file actions
29 lines (17 loc) · 684 Bytes
/
filters.py
File metadata and controls
29 lines (17 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from telegram import Chat
from telegram.ext import BaseFilter
class ReplyToBotFilter(BaseFilter):
def filter(self, message):
bot_username = message.bot.username
reply = message.reply_to_message
return bool(reply) and reply.from_user.username == bot_username
reply_to_bot_filter = ReplyToBotFilter()
class SuperGroupFilter(BaseFilter):
def filter(self, message):
return message.chat.type == Chat.SUPERGROUP
supergroup_filter = SuperGroupFilter()
class PermittedChatFilter(BaseFilter):
def __init__(self, chat_ids):
self._chat_ids = chat_ids
def filter(self, message):
return message.chat_id in self._chat_ids