randydev's picture
fix try
1594ae8
raw
history blame
1.24 kB
from pyrogram import *
from pyrogram.types import *
from akn.AllDownloaderBot.helpers.funcs_mics import arzpaginate_modules, help_texts
@Client.on_callback_query(filters.regex(r"rhelp_module\((.+?)\)"))
async def azrhelp_module(_, cb):
module = cb.matches[0].group(1)
text = help_texts.get(module, "No help available.")
await cb.message.edit_text(
text,
reply_markup=InlineKeyboardMarkup([
[InlineKeyboardButton("« Back", callback_data="rhelp_back")]
])
)
@Client.on_callback_query(filters.regex(r"rhelp_(prev|next)\((\d+)\)"))
async def azrhelp_nav(_, cb):
direction, page = cb.matches[0].groups()
page = int(page)
page = page - 1 if direction == "prev" else page + 1
buttons = arzpaginate_modules(page, list(help_texts.keys()), "help")
await cb.message.edit_text(
"**Choose a module to view help:**",
reply_markup=InlineKeyboardMarkup(buttons)
)
@Client.on_callback_query(filters.regex("rhelp_back"))
async def azrhelp_back(_, cb):
buttons = arzpaginate_modules(0, list(help_texts.keys()), "help")
await cb.message.edit_text(
"**Choose a module to view help:**",
reply_markup=InlineKeyboardMarkup(buttons)
)