randydev commited on
Commit
7ef6cc2
Β·
1 Parent(s): 1594ae8
akn/AllDownloaderBot/azhelp.py CHANGED
@@ -1,12 +1,24 @@
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
  )
 
1
  from pyrogram import *
2
  from pyrogram.types import *
 
3
 
4
  @Client.on_message(filters.command("help"))
5
+ async def arzhelp_command(_, message):
6
+ keyboard = InlineKeyboardMarkup([
7
+ [
8
+ InlineKeyboardButton("🚫 Ban", callback_data="rhelp_ban"),
9
+ InlineKeyboardButton("πŸ”‡ Mute", callback_data="help_mute")
10
+ ],
11
+ [
12
+ InlineKeyboardButton("πŸ‘‘ Promote", callback_data="rhelp_promote"),
13
+ InlineKeyboardButton("πŸ›‘οΈ Demote", callback_data="rhelp_demote")
14
+ ],
15
+ [
16
+ InlineKeyboardButton("🧹 Clean", callback_data="rhelp_clean"),
17
+ InlineKeyboardButton("πŸ”’ Lock", callback_data="rhelp_lock")
18
+ ]
19
+ ])
20
+
21
+ await message.reply(
22
+ "**Admin Help Menu**\nChoose a category:",
23
+ reply_markup=keyboard
24
  )
akn/AllDownloaderBot/helpers/azrcallback.py CHANGED
@@ -1,34 +1,68 @@
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
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram import filters, Client
2
+ from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
 
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
+ @Client.on_callback_query(filters.regex("^rhelp_"))
37
+ async def rxhelp_callback(client, callback):
38
+ category = callback.data.split("_")[1]
39
+ keyboard = InlineKeyboardMarkup([
40
+ [InlineKeyboardButton("πŸ”™ Back", callback_data="rhelp_back")]
41
+ ])
42
+
43
+ await callback.edit_message_text(
44
+ help_texts.get(category, "Invalid help category!"),
45
+ reply_markup=keyboard
46
  )
47
 
48
+ @Client.on_callback_query(filters.regex("^rhelp_back"))
49
+ async def rhelp_back(client, callback):
50
+ keyboard = InlineKeyboardMarkup([
51
+ [
52
+ InlineKeyboardButton("🚫 Ban", callback_data="rhelp_ban"),
53
+ InlineKeyboardButton("πŸ”‡ Mute", callback_data="rhelp_mute")
54
+ ],
55
+ [
56
+ InlineKeyboardButton("πŸ‘‘ Promote", callback_data="rhelp_promote"),
57
+ InlineKeyboardButton("πŸ›‘οΈ Demote", callback_data="rhelp_demote")
58
+ ],
59
+ [
60
+ InlineKeyboardButton("🧹 Clean", callback_data="rhelp_clean"),
61
+ InlineKeyboardButton("πŸ”’ Lock", callback_data="rhelp_lock")
62
+ ]
63
+ ])
64
+
65
+ await callback.edit_message_text(
66
+ "**Admin Help Menu**\nChoose a category:",
67
+ reply_markup=keyboard
68
+ )
akn/AllDownloaderBot/helpers/funcs_mics.py DELETED
@@ -1,64 +0,0 @@
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