TelegramBot/plugins/commands/shutdown.py

19 lines
504 B
Python
Raw Normal View History

2023-08-27 23:43:16 +03:00
import asyncio
from pyrogram import filters
from pyrogram.types import Message
from classes.pyroclient import PyroClient
2023-08-30 15:41:34 +03:00
from modules import custom_filters
2023-08-27 23:43:16 +03:00
@PyroClient.on_message(
~filters.scheduled
& filters.private
2023-08-30 15:41:34 +03:00
& filters.command(["shutdown", "reboot", "restart"], prefixes=["/"])
& ~custom_filters.context # type: ignore
2023-08-27 23:43:16 +03:00
)
async def command_shutdown(app: PyroClient, msg: Message):
if msg.from_user.id == app.owner:
asyncio.get_event_loop().create_task(app.stop())