This repository has been archived on 2024-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
TelegramBot/modules/custom_filters.py

19 lines
472 B
Python
Raw Normal View History

2023-08-27 23:43:16 +03:00
"""Custom message filters"""
from pyrogram import filters
from pyrogram.types import Message
from classes.pyroclient import PyroClient
async def _owner_func(_, __: PyroClient, message: Message):
return False if message.from_user is None else __.owner == message.from_user.id
2023-08-30 15:41:34 +03:00
async def _context_func(_, __: PyroClient, message: Message):
return message.from_user.id in __.contexts
2023-08-27 23:43:16 +03:00
owner = filters.create(_owner_func)
2023-08-30 15:41:34 +03:00
context = filters.create(_context_func)