File size: 7,949 Bytes
b9140ec 7ef6cc2 45d8014 eefa5fd f87bfee eefa5fd 390a7ef 45d8014 1594ae8 b9140ec 7ef6cc2 eefa5fd 7ef6cc2 9f91460 436f6a3 45d8014 c4f04dd 7ef6cc2 1594ae8 f87bfee 45d8014 f87bfee 7ef6cc2 f87bfee 7ef6cc2 9f91460 7ef6cc2 f87bfee 7ef6cc2 f87bfee 7ef6cc2 1594ae8 f87bfee 9f91460 7ef6cc2 b9140ec 7ef6cc2 45d8014 c4f04dd 8a69589 c4f04dd 45d8014 7ef6cc2 f87bfee 7ef6cc2 f87bfee 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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
import time
from pyrogram import filters, Client
from pyrogram.types import *
from akn.utils.database import db
from akn.langs import transdev
@Client.on_callback_query(filters.regex("^arzlang_"))
async def arzset_language(_, callback):
lang_code = callback.data.split("_")[1]
await db.alldl_bot.update_one(
{"user_id": callback.from_user.id},
{"$set": {"language": lang_code}},
upsert=True
)
await callback.answer(f"Language set to {lang_code.upper()}!")
await callback.message.edit_text(
f"Language changed to {lang_code.upper()}! Use /start to see the changes.",
)
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"
"/muteall - Mute all users\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",
"stats": "**Statistics Commands:**\n"
"/stats - View user statistics.\n"
"/rmdup - Remove duplicate messages\n"
"/broadcast - Send a message to all users.\n",
"forcesub": "**Force Subscribe Commands (Owner-Only):**\n"
"/addjoin - Force subscribe to a channel.\n",
"blacklist": "**Blacklist Commands (Owner-Only):**\n"
"/addblacklist - Ban a user from using bot commands.\n"
"/rmblacklist - Unban a blacklisted user.\n"
"/blacklistchat - Block a chat from using the bot.\n"
"/viewblacklistusers - View blacklisted users.\n"
"/whitelistchat - Unblock a chat from using the bot.\n"
"/blacklistedchat - View blacklisted chats.\n",
"botsettings": "**Bot Settings Commands (Owner-Only):**\n"
"/nobutton - Toggle **ON/OFF** the `/start` button.\n"
"/setpic - Change the bot's display picture (resend if needed)\n"
"/delpic - Remove bot display picture (resend if needed).\n"
}
def get_help_texts(lang="en"):
return {
"ban": transdev.get("messages.help_ban", lang=lang),
"mute": transdev.get("messages.help_mute", lang=lang),
"promote": transdev.get("messages.help_promote", lang=lang),
"clean": transdev.get("messages.help_clean", lang=lang),
"lock": transdev.get("messages.help_lock", lang=lang),
"demote": transdev.get("messages.help_demote", lang=lang),
"downloader": transdev.get("messages.help_downloader", lang=lang),
"stats": transdev.get("messages.help_stats", lang=lang),
"forcesub": transdev.get("messages.help_forcesub", lang=lang),
"blacklist": transdev.get("messages.help_blacklist", lang=lang),
"botsettings": transdev.get("messages.help_botsettings", lang=lang),
}
@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|stats|forcesub|blacklist|botsettings)$")
)
async def rxhelp_callback(client, callback):
category = callback.data.split("_")[1]
user_data = await db.alldl_bot.find_one({"user_id": callback.from_user.id})
lang = user_data.get("language", "en") if user_data else "en"
help_text = get_help_texts(lang=lang)
keyboard = InlineKeyboardMarkup([
[InlineKeyboardButton("π Back", callback_data="rhelps_back")]
])
await callback.edit_message_text(
help_text.get(category, "β Help text not found."),
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("π Stats", callback_data="rhelp_stats")
],
[
InlineKeyboardButton("π Force Subscribe", callback_data="rhelp_forcesub"),
InlineKeyboardButton("π‘οΈ Blacklist", callback_data="rhelp_blacklist")
],
[
InlineKeyboardButton("βοΈ Bot Settings", callback_data="rhelp_botsettings"),
],
[
InlineKeyboardButton("β Close", callback_data="cclose"),
]
])
user_data = await db.alldl_bot.find_one({"user_id": callback.from_user.id})
lang = user_data.get("language", "en") if user_data else "en"
text_str = transdev.get(
"messages.welcome",
lang=lang,
name=callback.from_user.mention ,
ping=f"{latency:.2f}ms",
)
await callback.edit_message_text(
text_str,
reply_markup=keyboard
) |