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

19 lines
692 B
Python
Raw Normal View History

2023-01-10 13:52:44 +02:00
from os import getpid
2023-02-14 12:38:54 +02:00
2023-01-10 13:52:44 +02:00
from pyrogram import filters
2023-02-17 17:46:33 +02:00
from classes.poster_client import PosterClient
2023-01-10 13:52:44 +02:00
from pyrogram.types import Message
2023-02-14 12:38:54 +02:00
2023-01-10 13:52:44 +02:00
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
2023-02-14 12:38:54 +02:00
2023-01-10 13:52:44 +02:00
@app.on_message(~ filters.scheduled & filters.command(["kill", "die", "reboot"], prefixes=["", "/"]))
2023-02-17 17:46:33 +02:00
async def cmd_kill(app: PosterClient, msg: Message):
2023-01-10 13:52:44 +02:00
2023-02-17 22:55:38 +02:00
if msg.from_user.id in app.admins:
2023-01-10 13:52:44 +02:00
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)