File size: 4,209 Bytes
7ef6cc2
45d8014
 
 
 
 
 
 
 
 
 
1594ae8
7ef6cc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9f91460
 
 
436f6a3
 
 
45d8014
 
 
 
 
 
 
 
 
 
 
7ef6cc2
1594ae8
45d8014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7ef6cc2
 
 
9f91460
7ef6cc2
 
 
 
 
1594ae8
 
9f91460
7ef6cc2
 
 
 
 
 
 
 
 
 
 
 
 
45d8014
 
 
 
 
 
7ef6cc2
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
from pyrogram import filters, Client
from pyrogram.types import *

unmute_permissions = ChatPermissions(
    can_send_messages=True,
    can_send_media_messages=True,
    can_send_polls=True,
    can_change_info=False,
    can_invite_users=True,
    can_pin_messages=False,
)

help_texts = {
    "ban": "**Ban Commands:**\n"
           "/ban - Ban a user\n"
           "/unban - Unban a user\n"
           "/tban - Temporary ban\n"
           "/banme - Ban yourself",
           
    "mute": "**Mute Commands:**\n"
            "/mute - Mute a user\n"
            "/unmute - Unmute user\n"
            "/tmute - Temporary mute\n"
            "/muteme - Mute yourself",
            
    "promote": "**Promotion Commands:**\n"
              "/promote - Promote user\n"
              "/demote - Demote user\n"
              "/title - Set admin title\n"
              "/adminlist - List admins",
              
    "clean": "**Cleaning Commands:**\n"
            "/del - Delete message\n"
            "/purge - Purge messages\n"
            "/delall - Delete all messages\n"
            "/setgpic - Set group photo",
            
    "lock": "**Locking Commands:**\n"
           "/lock - Lock permissions\n"
           "/unlock - Unlock permissions\n"
           "/locks - Current locks\n"
           "/locktypes - Available locks",
    
    "demote": "**Demotion Commands:**\n"
            "/demote - Demote user\n"
            "/undemote - Undemote user\n"
            "/demoteme - Demote yourself\n"
            "/demoteall - Demote all admins",

    "downloader": "**Downloader Commands:**\n"
            "/igdl - Instgram Downloader\n"
            "/ytv - Youtube Downloader\n"
            "/yta - Youtube Audio Downloader\n"
            "/ytva - Youtube Video Audio Downloader\n"
            "/fbdl - Facebook Downloader\n"
            "/ttdl - Tiktok Downloader\n"
            "/twtdl - Twitter Downloader\n"
            "alldl - All Downloader\n"
}

@Client.on_message(filters.regex("^arzunban_(\d+)"))
async def arzunban_callback(client, callback):
    user_id = int(callback.data.split("_")[1])
    chat_id = callback.chat.id
    try:
        await client.unban_chat_member(chat_id, user_id)
        await callback.answer("User unbanned successfully!")
    except Exception as e:
        await callback.answer(f"Failed to unban user: {e}")

@Client.on_message(filters.regex("^arzunmute_(\d+)"))
async def arzunmute_callback(client, callback):
    user_id = int(callback.data.split("_")[1])
    chat_id = callback.chat.id
    try:
        await client.restrict_chat_member(chat_id, user_id, permissions=unmute_permissions)
        await callback.answer("User unmuted successfully!")
    except Exception as e:
        await callback.answer(f"Failed to unmute user: {e}")

@Client.on_callback_query(filters.regex("^rhelp_(ban|mute|promote|demote|clean|lock|downloader$"))
async def rxhelp_callback(client, callback):
    category = callback.data.split("_")[1]
    keyboard = InlineKeyboardMarkup([
        [InlineKeyboardButton("πŸ”™ Back", callback_data="rhelps_back")]
    ])
    
    await callback.edit_message_text(
        help_texts.get(category, "Invalid help category!"),
        reply_markup=keyboard
    )

@Client.on_callback_query(filters.regex("^rhelps_back"))
async def rhelp_back(client, callback):
    keyboard = InlineKeyboardMarkup([
        [
            InlineKeyboardButton("🚫 Ban", callback_data="rhelp_ban"),
            InlineKeyboardButton("πŸ”‡ Mute", callback_data="rhelp_mute")
        ],
        [
            InlineKeyboardButton("πŸ‘‘ Promote", callback_data="rhelp_promote"),
            InlineKeyboardButton("πŸ›‘οΈ Demote", callback_data="rhelp_demote")
        ],
        [
            InlineKeyboardButton("🧹 Clean", callback_data="rhelp_clean"),
            InlineKeyboardButton("πŸ”’ Lock", callback_data="rhelp_lock")
        ],
        [
            InlineKeyboardButton("πŸ“₯ Downloader", callback_data="rhelp_downloader"),
        ],
        [
            InlineKeyboardButton("❌ Close", callback_data="cclose"),
        ]
    ])
    await callback.edit_message_text(
        "**Admin Help Menu**\nChoose a category:",
        reply_markup=keyboard
    )