File size: 4,631 Bytes
b9140ec 7ef6cc2 45d8014 1594ae8 b9140ec 7ef6cc2 9f91460 436f6a3 45d8014 b9140ec 7ef6cc2 1594ae8 45d8014 f3e70e8 7ef6cc2 9f91460 7ef6cc2 1594ae8 9f91460 7ef6cc2 b9140ec 7ef6cc2 45d8014 7ef6cc2 b9140ec 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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
import time
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,
)
GROUP_TEXTS = """
Hi {name} i am a modular group management bot with some fun extras.
Resfresh Ping: `{ping}`
i can do Azrea Bot of things, and help u manage your group effortlessly!
All Command can be accessed by using: `/`
**Click on help to learn more!**
"""
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):
start = time.time()
await client.get_me()
end = time.time()
latency = (end - start) * 1000
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(
GROUP_TEXTS.format(name=callback.from_user.mention, ping=f"{latency:.2f}ms"),
reply_markup=keyboard
) |