from app import app from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton from pyrogram.client import Client from pyrogram import filters from modules.database import col_spoilers from bson.objectid import ObjectId from modules.utils import configGet, locale # Callback sid ================================================================================================================= @app.on_callback_query(filters.regex("sid_[\s\S]*")) async def callback_query_sid(app: Client, clb: CallbackQuery): await clb.answer(url=f'https://t.me/{(await app.get_me()).username}?start={clb.data.split("_")[1]}') # ============================================================================================================================== # Callback shc ================================================================================================================= @app.on_callback_query(filters.regex("shc_[\s\S]*")) async def callback_query_shc(app: Client, clb: CallbackQuery): spoil = col_spoilers.find_one( {"_id": ObjectId(clb.data.split("_")[1])} ) if spoil["description"] == "": desc = locale("spoiler_empty_named", "message", locale=clb.from_user).format(locale(spoil["category"], "message", "spoiler_categories"), clb.from_user.first_name) else: desc = locale("spoiler_described_named", "message", locale=clb.from_user).format(locale(spoil["category"], "message", "spoiler_categories"), clb.from_user.first_name, spoil["description"]) await app.send_message(configGet("users", "groups"), desc, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("spoiler_view", "button", locale=clb.from_user), callback_data=f'sid_{clb.data.split("_")[1]}')]])) await app.send_message(configGet("admin", "groups"), desc, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(locale("spoiler_view", "button", locale=clb.from_user), callback_data=f'sid_{clb.data.split("_")[1]}')]])) await clb.answer(locale("spoiler_sent", "callback", locale=clb.from_user), show_alert=True) # ==============================================================================================================================