mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-07 15:34:52 +00:00
Merge pull request #25 from n1ret/main
Added compatibility with Story object to chat filter
This commit is contained in:
commit
b8579d7658
1 changed files with 40 additions and 11 deletions
|
|
@ -18,11 +18,19 @@
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Union, List, Pattern
|
from typing import Callable, List, Pattern, Union
|
||||||
|
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import enums
|
from pyrogram import enums
|
||||||
from pyrogram.types import Message, CallbackQuery, InlineQuery, InlineKeyboardMarkup, ReplyKeyboardMarkup, Update
|
from pyrogram.types import (
|
||||||
|
CallbackQuery,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
|
InlineQuery,
|
||||||
|
Message,
|
||||||
|
ReplyKeyboardMarkup,
|
||||||
|
Story,
|
||||||
|
Update,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Filter:
|
class Filter:
|
||||||
|
|
@ -979,7 +987,28 @@ class chat(Filter, set):
|
||||||
else c for c in chats
|
else c for c in chats
|
||||||
)
|
)
|
||||||
|
|
||||||
async def __call__(self, _, message: Message):
|
async def __call__(self, _, message: Union[Message, Story]):
|
||||||
|
if isinstance(message, Story):
|
||||||
|
return (
|
||||||
|
message.sender_chat
|
||||||
|
and (
|
||||||
|
message.sender_chat.id in self
|
||||||
|
or (
|
||||||
|
message.sender_chat.username
|
||||||
|
and message.sender_chat.username.lower() in self
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) or (
|
||||||
|
message.from_user
|
||||||
|
and (
|
||||||
|
message.from_user.id in self
|
||||||
|
or (
|
||||||
|
message.from_user.username
|
||||||
|
and message.from_user.username.lower() in self
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
return (message.chat
|
return (message.chat
|
||||||
and (message.chat.id in self
|
and (message.chat.id in self
|
||||||
or (message.chat.username
|
or (message.chat.username
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue