File size: 1,235 Bytes
1594ae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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)
    )