19 lines
869 B
Python
19 lines
869 B
Python
from app import app, isAnAdmin
|
|
from os import getpid
|
|
from sys import exit
|
|
from pyrogram import filters
|
|
from modules.utils import logWrite, should_quote
|
|
from modules.scheduled import scheduler
|
|
|
|
pid = getpid()
|
|
|
|
# Shutdown command =============================================================================================================
|
|
@app.on_message(~ filters.scheduled & filters.private & filters.command(["kill", "die", "reboot"], prefixes=["/"]))
|
|
async def cmd_kill(app, msg):
|
|
|
|
if await isAnAdmin(msg.from_user.id) is True:
|
|
logWrite(f"Shutting down bot with pid {pid}")
|
|
await msg.reply_text(f"Вимкнення бота з підом `{pid}`", quote=should_quote(msg))
|
|
scheduler.shutdown()
|
|
exit()
|
|
# ============================================================================================================================== |