Profitroll
5adb004a2a
* `/report` command added * Updated to libbot 1.5 * Moved to [PhotosAPI_Client](https://git.end-play.xyz/profitroll/PhotosAPI_Client) v0.5.0 from using self-made API client * Video support (almost stable) * Bug fixes and improvements Co-authored-by: profitroll <vozhd.kk@gmail.com> Reviewed-on: #27
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
from os import makedirs
|
|
from pathlib import Path
|
|
from time import time
|
|
|
|
from libbot import json_write
|
|
from pyrogram import filters
|
|
from pyrogram.client import Client
|
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
|
|
|
from classes.pyroclient import PyroClient
|
|
from modules.utils import USERS_WITH_CONTEXT
|
|
|
|
|
|
@Client.on_message(
|
|
~filters.scheduled & filters.command(["shutdown"], prefixes=["", "/"])
|
|
)
|
|
async def cmd_kill(app: PyroClient, msg: Message):
|
|
if msg.from_user.id not in app.admins:
|
|
return
|
|
|
|
if len(USERS_WITH_CONTEXT) > 0:
|
|
await msg.reply_text(
|
|
app._("shutdown_confirm", "message").format(len(USERS_WITH_CONTEXT)),
|
|
reply_markup=InlineKeyboardMarkup(
|
|
[
|
|
[
|
|
InlineKeyboardButton(
|
|
app._(
|
|
"shutdown", "button", locale=msg.from_user.language_code
|
|
),
|
|
callback_data="shutdown",
|
|
)
|
|
]
|
|
]
|
|
),
|
|
)
|
|
return
|
|
|
|
makedirs(app.config["locations"]["cache"], exist_ok=True)
|
|
await json_write(
|
|
{"timestamp": time()},
|
|
Path(f"{app.config['locations']['cache']}/shutdown_time"),
|
|
)
|
|
|
|
exit()
|