import asyncio from pyrogram import filters from pyrogram.types import Message from classes.pyroclient import PyroClient from modules import custom_filters @PyroClient.on_message( ~filters.scheduled & filters.private & filters.command(["shutdown", "reboot", "restart"], prefixes=["/"]) & ~custom_filters.context # type: ignore ) async def command_shutdown(app: PyroClient, msg: Message): if msg.from_user.id == app.owner: asyncio.get_event_loop().create_task(app.stop())