22 lines
610 B
Python
22 lines
610 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import logging
|
|
from os import getpid
|
|
|
|
from libbot import config_get
|
|
from pyrogram import filters
|
|
from pyrogram.client import Client
|
|
from pyrogram.types import Message
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@Client.on_message(
|
|
~filters.scheduled & filters.command(["kill", "die", "shutdown"], prefixes="/") # type: ignore
|
|
)
|
|
async def command_shutdown(app: Client, msg: Message):
|
|
if msg.from_user.id == app.owner:
|
|
await msg.reply_text(f"Shutting down bot with pid **{getpid()}**")
|
|
logger.info(f"Shutting down as requested by {msg.from_user.id}")
|
|
exit()
|