This repository has been archived on 2024-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
TelegramPoster/plugins/commands/general.py

25 lines
741 B
Python

from os import getpid
from pyrogram import filters
from classes.poster_client import PosterClient
from pyrogram.types import Message
from modules.app import app
from modules.logger 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: PosterClient, msg: Message):
if msg.from_user.id in app.admins:
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)