|
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 |
|
) |