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.
TelegramPoster/plugins/callbacks/shutdown.py
Profitroll 5adb004a2a API usage overhaul (#27)
* `/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
2023-06-28 00:57:30 +03:00

26 lines
667 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, 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()