mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Add chat filter
This commit is contained in:
parent
dfa1e51281
commit
cbf9104aa3
@ -80,10 +80,26 @@ class Filters:
|
|||||||
"User",
|
"User",
|
||||||
lambda _, m: bool(m.from_user
|
lambda _, m: bool(m.from_user
|
||||||
and (m.from_user.id in _.u
|
and (m.from_user.id in _.u
|
||||||
or m.from_user.username.lower() in _.u)),
|
or (m.from_user.username
|
||||||
|
and m.from_user.username.lower() in _.u))),
|
||||||
u=(
|
u=(
|
||||||
{user.lower().strip("@") if type(user) is str else user}
|
{user.lower().strip("@") if type(user) is str else user}
|
||||||
if not isinstance(user, list)
|
if not isinstance(user, list)
|
||||||
else {i.lower().strip("@") if type(i) is str else i for i in user}
|
else {i.lower().strip("@") if type(i) is str else i for i in user}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def chat(chat: int or str or list):
|
||||||
|
return build(
|
||||||
|
"Chat",
|
||||||
|
lambda _, m: bool(m.chat
|
||||||
|
and (m.chat.id in _.c
|
||||||
|
or (m.chat.username
|
||||||
|
and m.chat.username.lower() in _.c))),
|
||||||
|
c=(
|
||||||
|
{chat.lower().strip("@") if type(chat) is str else chat}
|
||||||
|
if not isinstance(chat, list)
|
||||||
|
else {i.lower().strip("@") if type(i) is str else i for i in chat}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user