fix try
Browse files
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
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
)
|
27 |
|
28 |
-
@Client.on_callback_query(filters.regex("rhelp_back"))
|
29 |
-
async def
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|