randydev commited on
Commit
1594ae8
·
1 Parent(s): 0a6e94f
akn/AllDownloaderBot/azhelp.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram import *
2
+ from pyrogram.types import *
3
+ from akn.AllDownloaderBot.helpers.funcs_mics import arzpaginate_modules, help_texts
4
+
5
+ @Client.on_message(filters.command("help"))
6
+ async def azrhelp_menu(_, message):
7
+ page = 0
8
+ buttons = arzpaginate_modules(page, list(help_texts.keys()), "help")
9
+ await message.reply_text(
10
+ "**Choose a module to view help:**",
11
+ reply_markup=InlineKeyboardMarkup(buttons)
12
+ )
akn/AllDownloaderBot/helpers/azrcallback.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram import *
2
+ from pyrogram.types import *
3
+ from akn.AllDownloaderBot.helpers.funcs_mics import arzpaginate_modules, help_texts
4
+
5
+ @Client.on_callback_query(filters.regex(r"rhelp_module\((.+?)\)"))
6
+ async def azrhelp_module(_, cb):
7
+ module = cb.matches[0].group(1)
8
+ text = help_texts.get(module, "No help available.")
9
+ await cb.message.edit_text(
10
+ text,
11
+ reply_markup=InlineKeyboardMarkup([
12
+ [InlineKeyboardButton("« Back", callback_data="rhelp_back")]
13
+ ])
14
+ )
15
+
16
+ @Client.on_callback_query(filters.regex(r"rhelp_(prev|next)\((\d+)\)"))
17
+ async def azrhelp_nav(_, cb):
18
+ direction, page = cb.matches[0].groups()
19
+ page = int(page)
20
+ page = page - 1 if direction == "prev" else page + 1
21
+
22
+ buttons = arzpaginate_modules(page, list(help_texts.keys()), "help")
23
+ await cb.message.edit_text(
24
+ "**Choose a module to view help:**",
25
+ reply_markup=InlineKeyboardMarkup(buttons)
26
+ )
27
+
28
+ @Client.on_callback_query(filters.regex("rhelp_back"))
29
+ async def azrhelp_back(_, cb):
30
+ buttons = arzpaginate_modules(0, list(help_texts.keys()), "help")
31
+ await cb.message.edit_text(
32
+ "**Choose a module to view help:**",
33
+ reply_markup=InlineKeyboardMarkup(buttons)
34
+ )
akn/AllDownloaderBot/helpers/funcs_mics.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram.types import *
2
+ import math
3
+
4
+ help_texts = {
5
+ "ban": "**Ban Commands:**\n"
6
+ "/ban - Ban a user\n"
7
+ "/unban - Unban a user\n"
8
+ "/tban - Temporary ban\n"
9
+ "/banme - Ban yourself",
10
+
11
+ "mute": "**Mute Commands:**\n"
12
+ "/mute - Mute a user\n"
13
+ "/unmute - Unmute user\n"
14
+ "/tmute - Temporary mute\n"
15
+ "/muteme - Mute yourself",
16
+
17
+ "promote": "**Promotion Commands:**\n"
18
+ "/promote - Promote user\n"
19
+ "/demote - Demote user\n"
20
+ "/title - Set admin title\n"
21
+ "/adminlist - List admins",
22
+
23
+ "clean": "**Cleaning Commands:**\n"
24
+ "/del - Delete message\n"
25
+ "/purge - Purge messages\n"
26
+ "/delall - Delete all messages\n"
27
+ "/setgpic - Set group photo",
28
+
29
+ "lock": "**Locking Commands:**\n"
30
+ "/lock - Lock permissions\n"
31
+ "/unlock - Unlock permissions\n"
32
+ "/locks - Current locks\n"
33
+ "/locktypes - Available locks"
34
+ }
35
+
36
+ def arzpaginate_modules(page_n, modules, prefix, per_page=4):
37
+ modules = sorted(modules)
38
+ max_pages = math.ceil(len(modules) / per_page)
39
+ page = page_n % max_pages
40
+
41
+ buttons = [
42
+ InlineKeyboardButton(
43
+ text=f"📘 {mod.capitalize()}",
44
+ callback_data=f"{prefix}_module({mod})"
45
+ ) for mod in modules[page * per_page:(page + 1) * per_page]
46
+ ]
47
+
48
+ pairs = list(zip(buttons[::2], buttons[1::2]))
49
+ if len(buttons) % 2 == 1:
50
+ pairs.append((buttons[-1],))
51
+
52
+ nav_buttons = []
53
+ if max_pages > 1:
54
+ nav_buttons.append(
55
+ InlineKeyboardButton("⏪", callback_data=f"{prefix}_prev({page})")
56
+ )
57
+ nav_buttons.append(
58
+ InlineKeyboardButton("⏩", callback_data=f"{prefix}_next({page})")
59
+ )
60
+
61
+ if nav_buttons:
62
+ pairs.append(tuple(nav_buttons))
63
+
64
+ return pairs
akn/manage/callback.py CHANGED
@@ -282,7 +282,7 @@ async def cb_customiz_bot(client, query):
282
  ],
283
  [
284
  InlineKeyboardButton(
285
- "All Downloader Bot",
286
  callback_data="tutorial_alldlbot"
287
  ),
288
  ],
@@ -1323,7 +1323,7 @@ async def tutor_alldlbot(client, cb: CallbackQuery):
1323
  check_tutorial = """
1324
  <b> Tutorial bot token clone</b>
1325
 
1326
- <b>All Downloader Bot</b>
1327
 
1328
  It only takes a few minutes to activate your own unique bot with 0 coding:
1329
 
 
282
  ],
283
  [
284
  InlineKeyboardButton(
285
+ "Azrea Bot",
286
  callback_data="tutorial_alldlbot"
287
  ),
288
  ],
 
1323
  check_tutorial = """
1324
  <b> Tutorial bot token clone</b>
1325
 
1326
+ <b>Azrea Bot</b>
1327
 
1328
  It only takes a few minutes to activate your own unique bot with 0 coding:
1329