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/modules/commands/general.py

16 lines
679 B
Python
Raw Normal View History

2023-01-10 13:52:44 +02:00
from os import getpid
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import Message
from modules.app import app
2023-01-17 12:43:10 +02:00
from modules.logger import logWrite
2023-01-10 13:52:44 +02:00
from modules.utils import configGet, killProc, locale
@app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"]))
2023-01-10 14:06:24 +02:00
async def cmd_kill(app: Client, msg: Message):
2023-01-10 13:52:44 +02:00
if msg.from_user.id == configGet("admin"):
pid = getpid()
logWrite(locale("shutdown", "console", locale=configGet("locale")).format(str(pid)))
2023-01-10 14:06:24 +02:00
await msg.reply_text(locale("shutdown", "message", locale=configGet("locale")).format(str(pid)))
2023-01-10 13:52:44 +02:00
killProc(pid)