Contextual keyboard [WIP]
This commit is contained in:
parent
c1ee988106
commit
9ce05589b0
@ -2,7 +2,7 @@ from os import sep
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.client import Client
|
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.api_client import upload_pic
|
||||||
from modules.utils import jsonLoad, jsonSave, configGet, locale
|
from modules.utils import jsonLoad, jsonSave, configGet, locale
|
||||||
from modules.submissions import subBlock, subUnblock
|
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 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)
|
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]*"))
|
@app.on_callback_query(filters.regex("sub_no_[\s\S]*_[\s\S]*"))
|
||||||
async def callback_query_no(app: Client, clb: CallbackQuery):
|
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 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)
|
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]*"))
|
@app.on_callback_query(filters.regex("sub_block_[\s\S]*"))
|
||||||
async def callback_query_block(app: Client, clb: CallbackQuery):
|
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]))
|
subBlock(int(fullclb[2]))
|
||||||
await clb.answer(text=locale("sub_block", "callback", locale=user_locale).format(fullclb[2]), show_alert=True)
|
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]*"))
|
@app.on_callback_query(filters.regex("sub_unblock_[\s\S]*"))
|
||||||
async def callback_query_unblock(app: Client, clb: CallbackQuery):
|
async def callback_query_unblock(app: Client, clb: CallbackQuery):
|
||||||
@ -74,3 +83,6 @@ async def callback_query_unblock(app: Client, clb: CallbackQuery):
|
|||||||
await app.send_message(int(fullclb[2]), locale("sub_msg_unavail", "message", locale=configGet("locale")))
|
await app.send_message(int(fullclb[2]), locale("sub_msg_unavail", "message", locale=configGet("locale")))
|
||||||
subUnblock(int(fullclb[2]))
|
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))
|
Reference in New Issue
Block a user