from os import getpid from pyrogram import filters from pyrogram.client import Client from pyrogram.types import Message from modules.app import app from modules.logging import logWrite from modules.utils import configGet, killProc, locale @app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"])) async def cmd_kill(app: Client, msg: Message): if msg.from_user.id == configGet("admin"): pid = getpid() logWrite(locale("shutdown", "console", locale=configGet("locale")).format(str(pid))) await msg.reply_text(locale("shutdown", "message", locale=configGet("locale")).format(str(pid))) killProc(pid)