Modularity overhaul
This commit is contained in:
16
modules/commands/reboot.py
Normal file
16
modules/commands/reboot.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from app import app, isAnAdmin
|
||||
from os import getpid
|
||||
from pyrogram import filters
|
||||
from modules.utils import configGet, logWrite, killProc, should_quote
|
||||
|
||||
pid = getpid()
|
||||
|
||||
# Shutdown command =============================================================================================================
|
||||
@app.on_message(~ filters.scheduled & filters.private & filters.command(["kill", "die", "reboot"], prefixes=["/"]))
|
||||
async def cmd_kill(app, msg):
|
||||
|
||||
if msg.chat.id == configGet("admin_group") or await isAnAdmin(msg.from_user.id):
|
||||
logWrite(f"Shutting down bot with pid {pid}")
|
||||
await msg.reply_text(f"Вимкнення бота з підом `{pid}`", quote=should_quote(msg))
|
||||
killProc(pid)
|
||||
# ==============================================================================================================================
|
Reference in New Issue
Block a user