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.
BWTAqua/plugins/shutdown.py

22 lines
629 B
Python
Raw Normal View History

2023-05-16 21:50:18 +03:00
# -*- 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
)
2023-05-16 21:51:48 +03:00
async def command_shutdown(app: Client, msg: Message):
2023-05-16 21:50:18 +03:00
if msg.from_user.id == await config_get("owner_id"):
await msg.reply_text(f"Shutting down bot with pid **{getpid()}**")
logger.info(f"Shutting down as requested by {msg.from_user.id}")
exit()