Contextual keyboard [WIP]

This commit is contained in:
Profitroll 2023-01-17 14:38:21 +01:00
parent c1ee988106
commit 9ce05589b0

View File

@ -2,7 +2,7 @@ from os import sep
from pathlib import Path
from pyrogram import filters
from pyrogram.client import Client
from pyrogram.types import CallbackQuery
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, InlineKeyboardButton
from modules.api_client import upload_pic
from modules.utils import jsonLoad, jsonSave, configGet, locale
from modules.submissions import subBlock, subUnblock
@ -44,6 +44,9 @@ async def callback_query_yes(app: Client, clb: CallbackQuery):
await submission.reply_text(locale("sub_yes", "message", locale=submission.from_user.language_code), quote=True)
await clb.answer(text=locale("sub_yes", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
# edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
# await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
@app.on_callback_query(filters.regex("sub_no_[\s\S]*_[\s\S]*"))
async def callback_query_no(app: Client, clb: CallbackQuery):
@ -57,6 +60,9 @@ async def callback_query_no(app: Client, clb: CallbackQuery):
await submission.reply_text(locale("sub_no", "message", locale=submission.from_user.language_code), quote=True)
await clb.answer(text=locale("sub_no", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
# edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
# await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
@app.on_callback_query(filters.regex("sub_block_[\s\S]*"))
async def callback_query_block(app: Client, clb: CallbackQuery):
@ -66,6 +72,9 @@ async def callback_query_block(app: Client, clb: CallbackQuery):
subBlock(int(fullclb[2]))
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
# edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
# await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))
@app.on_callback_query(filters.regex("sub_unblock_[\s\S]*"))
async def callback_query_unblock(app: Client, clb: CallbackQuery):
@ -73,4 +82,7 @@ async def callback_query_unblock(app: Client, clb: CallbackQuery):
user_locale = clb.from_user.language_code
await app.send_message(int(fullclb[2]), locale("sub_msg_unavail", "message", locale=configGet("locale")))
subUnblock(int(fullclb[2]))
await clb.answer(text=locale("sub_unblock", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
await clb.answer(text=locale("sub_unblock", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
# edited_markup = [[InlineKeyboardButton(text=str(locale("accepted", "button")), callback_data="nothing")]]
# await clb.message.edit(text=clb.message.text, reply_markup=InlineKeyboardMarkup(edited_markup))