26 lines
682 B
Python
26 lines
682 B
Python
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, callback: CallbackQuery):
|
|
if callback.from_user.id not in app.admins:
|
|
return
|
|
|
|
await callback.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()
|