social-dl/app/plugins/utils/restart.py
anonymousx97 31d19bc48b v2.5.0:Upstream with Private Repo.
What's New:
- Sort Plugins into their respective folders.
- download, upload, rename commands.
- Help Docstrings.
- Proper Logging.
- rename .exec cmd to .py
2024-01-08 16:01:41 +05:30

22 lines
639 B
Python

import os
from pyrogram.enums import ChatType
from app import BOT, Message, bot
@bot.add_cmd(cmd="restart")
async def restart(bot: BOT, message: Message, u_resp: Message | None = None) -> None:
"""
CMD: RESTART
INFO: Restart the Bot.
FLAGS: -h for hard restart and clearing logs
Usage:
.restart | .restart -h
"""
reply: Message = u_resp or await message.reply("restarting....")
if reply.chat.type in (ChatType.GROUP, ChatType.SUPERGROUP):
os.environ["RESTART_MSG"] = str(reply.id)
os.environ["RESTART_CHAT"] = str(reply.chat.id)
await bot.restart(hard="-h" in message.flags)