from os import makedirs, path from time import time from libbot import config_get, json_write from pyrogram import filters from pyrogram.client import Client from pyrogram.types import CallbackQuery from classes.pyroclient import PyroClient @Client.on_callback_query(filters.regex("shutdown")) async def callback_query_nothing(app: PyroClient, clb: CallbackQuery): if clb.from_user.id not in app.admins: return await clb.answer() makedirs(await config_get("cache", "locations"), exist_ok=True) await json_write( {"timestamp": time()}, path.join(await config_get("cache", "locations"), "shutdown_time"), ) exit()