Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
ffd8e21
1
Parent(s):
03b3acb
Update admin.py
Browse files- Powers/plugins/admin.py +14 -115
Powers/plugins/admin.py
CHANGED
|
@@ -5,11 +5,11 @@ from pyrogram import filters
|
|
| 5 |
from Powers.vars import Config
|
| 6 |
from traceback import format_exc
|
| 7 |
from Powers.bot_class import Gojo
|
|
|
|
| 8 |
from Powers.utils.parser import mention_html
|
| 9 |
from Powers.database.approve_db import Approve
|
| 10 |
from Powers.database.reporting_db import Reporting
|
| 11 |
from Powers.utils.extract_user import extract_user
|
| 12 |
-
from pyrogram.types import Message, ChatPrivileges
|
| 13 |
from pyrogram.enums import ChatType, ChatMemberStatus as CMS
|
| 14 |
from Powers import LOGGER, OWNER_ID, DEV_USERS, SUPPORT_GROUP, SUPPORT_STAFF
|
| 15 |
from Powers.utils.caching import (
|
|
@@ -19,12 +19,9 @@ from Powers.utils.custom_filters import (
|
|
| 19 |
from pyrogram.errors import (
|
| 20 |
RPCError, FloodWait, RightForbidden, UserAdminInvalid, ChatAdminRequired,
|
| 21 |
ChatAdminInviteRequired)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
@Gojo.on_message(command("adminlist"))
|
| 25 |
async def adminlist_show(_, m: Message):
|
| 26 |
global ADMIN_CACHE
|
| 27 |
-
|
| 28 |
if m.chat.type != ChatType.SUPERGROUP:
|
| 29 |
return await m.reply_text(
|
| 30 |
text="This command is made to be used in groups only!",
|
|
@@ -36,12 +33,9 @@ async def adminlist_show(_, m: Message):
|
|
| 36 |
except KeyError:
|
| 37 |
admin_list = await admin_cache_reload(m, "adminlist")
|
| 38 |
note = "<i>Note:</i> These are up-to-date values!"
|
| 39 |
-
|
| 40 |
adminstr = f"Admins in <b>{m.chat.title}</b>:" + "\n\n"
|
| 41 |
-
|
| 42 |
bot_admins = [i for i in admin_list if (i[1].lower()).endswith("bot")]
|
| 43 |
user_admins = [i for i in admin_list if not (i[1].lower()).endswith("bot")]
|
| 44 |
-
|
| 45 |
# format is like: (user_id, username/name,anonyamous or not)
|
| 46 |
mention_users = [
|
| 47 |
(
|
|
@@ -53,7 +47,6 @@ async def adminlist_show(_, m: Message):
|
|
| 53 |
if not admin[2] # if non-anonyamous admin
|
| 54 |
]
|
| 55 |
mention_users.sort(key=lambda x: x[1])
|
| 56 |
-
|
| 57 |
mention_bots = [
|
| 58 |
(
|
| 59 |
admin[1]
|
|
@@ -63,15 +56,12 @@ async def adminlist_show(_, m: Message):
|
|
| 63 |
for admin in bot_admins
|
| 64 |
]
|
| 65 |
mention_bots.sort(key=lambda x: x[1])
|
| 66 |
-
|
| 67 |
adminstr += "<b>User Admins:</b>\n"
|
| 68 |
adminstr += "\n".join(f"- {i}" for i in mention_users)
|
| 69 |
adminstr += "\n\n<b>Bots:</b>\n"
|
| 70 |
adminstr += "\n".join(f"- {i}" for i in mention_bots)
|
| 71 |
-
|
| 72 |
await m.reply_text(adminstr + "\n\n" + note)
|
| 73 |
LOGGER.info(f"Adminlist cmd use in {m.chat.id} by {m.from_user.id}")
|
| 74 |
-
|
| 75 |
except Exception as ef:
|
| 76 |
if str(ef) == str(m.chat.id):
|
| 77 |
await m.reply_text(text="Use /admincache to reload admins!")
|
|
@@ -82,15 +72,10 @@ async def adminlist_show(_, m: Message):
|
|
| 82 |
)
|
| 83 |
LOGGER.error(ef)
|
| 84 |
LOGGER.error(format_exc())
|
| 85 |
-
|
| 86 |
return
|
| 87 |
-
|
| 88 |
-
|
| 89 |
@Gojo.on_message(command("zombies") & owner_filter)
|
| 90 |
async def zombie_clean(c: Gojo, m: Message):
|
| 91 |
-
|
| 92 |
zombie = 0
|
| 93 |
-
|
| 94 |
wait = await m.reply_text("Searching ... and banning ...")
|
| 95 |
async for member in c.get_chat_members(m.chat.id):
|
| 96 |
if member.user.is_deleted:
|
|
@@ -106,17 +91,13 @@ async def zombie_clean(c: Gojo, m: Message):
|
|
| 106 |
return await wait.edit_text(
|
| 107 |
text=f"<b>{zombie}</b> Zombies found and has been banned!",
|
| 108 |
)
|
| 109 |
-
|
| 110 |
-
|
| 111 |
@Gojo.on_message(command("admincache"))
|
| 112 |
async def reload_admins(_, m: Message):
|
| 113 |
global TEMP_ADMIN_CACHE_BLOCK
|
| 114 |
-
|
| 115 |
if m.chat.type != ChatType.SUPERGROUP:
|
| 116 |
return await m.reply_text(
|
| 117 |
"This command is made to be used in groups only!",
|
| 118 |
)
|
| 119 |
-
|
| 120 |
if (
|
| 121 |
(m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
|
| 122 |
and (m.from_user.id not in SUPPORT_STAFF)
|
|
@@ -124,7 +105,6 @@ async def reload_admins(_, m: Message):
|
|
| 124 |
):
|
| 125 |
await m.reply_text("Can only reload admin cache once per 10 mins!")
|
| 126 |
return
|
| 127 |
-
|
| 128 |
try:
|
| 129 |
await admin_cache_reload(m, "admincache")
|
| 130 |
TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "manualblock"
|
|
@@ -137,19 +117,15 @@ async def reload_admins(_, m: Message):
|
|
| 137 |
LOGGER.error(ef)
|
| 138 |
LOGGER.error(format_exc())
|
| 139 |
return
|
| 140 |
-
|
| 141 |
-
|
| 142 |
@Gojo.on_message(filters.regex(r"^(?i)@admin(s)?") & filters.group)
|
| 143 |
async def tag_admins(_, m: Message):
|
| 144 |
db = Reporting(m.chat.id)
|
| 145 |
if not db.get_settings():
|
| 146 |
return
|
| 147 |
-
|
| 148 |
try:
|
| 149 |
admin_list = ADMIN_CACHE[m.chat.id]
|
| 150 |
except KeyError:
|
| 151 |
admin_list = await admin_cache_reload(m, "adminlist")
|
| 152 |
-
|
| 153 |
user_admins = [i for i in admin_list if not (i[1].lower()).endswith("bot")]
|
| 154 |
mention_users = [(await mention_html("\u2063", admin[0])) for admin in user_admins]
|
| 155 |
mention_users.sort(key=lambda x: x[1])
|
|
@@ -160,34 +136,26 @@ async def tag_admins(_, m: Message):
|
|
| 160 |
f" reported the message to admins!{mention_str}"
|
| 161 |
),
|
| 162 |
)
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
@Gojo.on_message(command(["fullpromote", "fulpromote"]) & promote_filter)
|
| 166 |
async def fullpromote_usr(c: Gojo, m: Message):
|
| 167 |
global ADMIN_CACHE
|
| 168 |
-
|
| 169 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 170 |
await m.reply_text(
|
| 171 |
text="I can't promote nothing! Give me an username or user id or atleast reply to that user"
|
| 172 |
)
|
| 173 |
return
|
| 174 |
-
|
| 175 |
try:
|
| 176 |
user_id, user_first_name, user_name = await extract_user(c, m)
|
| 177 |
except Exception:
|
| 178 |
return
|
| 179 |
-
|
| 180 |
bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
|
| 181 |
-
|
| 182 |
if user_id == Config.BOT_ID:
|
| 183 |
await m.reply_text("Huh, how can I even promote myself?")
|
| 184 |
return
|
| 185 |
-
|
| 186 |
if not bot.privileges.can_promote_members:
|
| 187 |
return await m.reply_text(
|
| 188 |
"I don't have enough permissions!",
|
| 189 |
) # This should be here
|
| 190 |
-
|
| 191 |
user = await c.get_chat_member(m.chat.id, m.from_user.id)
|
| 192 |
if m.from_user.id != OWNER_ID and user.status != CMS.OWNER:
|
| 193 |
return await m.reply_text("This command can only be used by chat owner.")
|
|
@@ -198,17 +166,15 @@ async def fullpromote_usr(c: Gojo, m: Message):
|
|
| 198 |
admin_list = {
|
| 199 |
i[0] for i in (await admin_cache_reload(m, "promote_cache_update"))
|
| 200 |
}
|
| 201 |
-
|
| 202 |
if user_id in admin_list:
|
| 203 |
await m.reply_text(
|
| 204 |
"This user is already an admin, how am I supposed to re-promote them?",
|
| 205 |
)
|
| 206 |
return
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
if len(m.text.split()) == 3 and not m.reply_to_message:
|
| 213 |
title = m.text.split()[2]
|
| 214 |
elif len(m.text.split()) == 2 and m.reply_to_message:
|
|
@@ -220,26 +186,22 @@ async def fullpromote_usr(c: Gojo, m: Message):
|
|
| 220 |
await c.set_administrator_title(m.chat.id, user_id, title)
|
| 221 |
except RPCError as e:
|
| 222 |
LOGGER.error(e)
|
| 223 |
-
|
| 224 |
LOGGER.info(
|
| 225 |
f"{m.from_user.id} fullpromoted {user_id} in {m.chat.id} with title '{title}'",
|
| 226 |
)
|
| 227 |
-
|
| 228 |
await m.reply_text(
|
| 229 |
-
("{promoter} promoted {promoted} in chat <b>{chat_title}</b> with
|
| 230 |
promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
| 231 |
promoted=(await mention_html(user_first_name, user_id)),
|
| 232 |
chat_title=f"{escape(m.chat.title)} title set to {title}"
|
| 233 |
if title
|
| 234 |
-
else f"{escape(m.chat.title)} title set to
|
| 235 |
),
|
| 236 |
)
|
| 237 |
-
|
| 238 |
# If user is approved, disapprove them as they willbe promoted and get
|
| 239 |
# even more rights
|
| 240 |
if Approve(m.chat.id).check_approve(user_id):
|
| 241 |
Approve(m.chat.id).remove_approve(user_id)
|
| 242 |
-
|
| 243 |
# ----- Add admin to temp cache -----
|
| 244 |
try:
|
| 245 |
inp1 = user_name or user_first_name
|
|
@@ -248,7 +210,6 @@ async def fullpromote_usr(c: Gojo, m: Message):
|
|
| 248 |
ADMIN_CACHE[m.chat.id] = admins_group
|
| 249 |
except KeyError:
|
| 250 |
await admin_cache_reload(m, "promote_key_error")
|
| 251 |
-
|
| 252 |
except ChatAdminRequired:
|
| 253 |
await m.reply_text(text="I'm not admin or I don't have rights......")
|
| 254 |
except RightForbidden:
|
|
@@ -264,30 +225,22 @@ async def fullpromote_usr(c: Gojo, m: Message):
|
|
| 264 |
LOGGER.error(e)
|
| 265 |
LOGGER.error(format_exc())
|
| 266 |
return
|
| 267 |
-
|
| 268 |
-
|
| 269 |
@Gojo.on_message(command("promote") & promote_filter)
|
| 270 |
async def promote_usr(c: Gojo, m: Message):
|
| 271 |
-
|
| 272 |
global ADMIN_CACHE
|
| 273 |
-
|
| 274 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 275 |
await m.reply_text(
|
| 276 |
text="I can't promote nothing!......reply to user to promote him/her...."
|
| 277 |
)
|
| 278 |
return
|
| 279 |
-
|
| 280 |
try:
|
| 281 |
user_id, user_first_name, user_name = await extract_user(c, m)
|
| 282 |
except Exception:
|
| 283 |
return
|
| 284 |
-
|
| 285 |
bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
|
| 286 |
-
|
| 287 |
if user_id == Config.BOT_ID:
|
| 288 |
await m.reply_text("Huh, how can I even promote myself?")
|
| 289 |
return
|
| 290 |
-
|
| 291 |
if not bot.privileges.can_promote_members:
|
| 292 |
return await m.reply_text(
|
| 293 |
"I don't have enough permissions",
|
|
@@ -299,13 +252,11 @@ async def promote_usr(c: Gojo, m: Message):
|
|
| 299 |
admin_list = {
|
| 300 |
i[0] for i in (await admin_cache_reload(m, "promote_cache_update"))
|
| 301 |
}
|
| 302 |
-
|
| 303 |
if user_id in admin_list:
|
| 304 |
await m.reply_text(
|
| 305 |
"This user is already an admin, how am I supposed to re-promote them?",
|
| 306 |
)
|
| 307 |
return
|
| 308 |
-
|
| 309 |
try:
|
| 310 |
await m.chat.promote_member(
|
| 311 |
user_id=user_id,
|
|
@@ -319,40 +270,35 @@ async def promote_usr(c: Gojo, m: Message):
|
|
| 319 |
can_manage_video_chats=bot.privileges.can_manage_video_chats,
|
| 320 |
),
|
| 321 |
)
|
| 322 |
-
|
| 323 |
-
title = "" # Deafult title
|
| 324 |
if not m.chat.type == ChatType.SUPERGROUP:
|
|
|
|
| 325 |
if len(m.text.split()) == 3 and not m.reply_to_message:
|
| 326 |
title = m.text.split()[2]
|
| 327 |
elif len(m.text.split()) == 2 and m.reply_to_message:
|
| 328 |
title = m.text.split()[1]
|
| 329 |
if title and len(title) > 16:
|
| 330 |
title = title[0:16] # trim title to 16 characters
|
| 331 |
-
|
| 332 |
try:
|
| 333 |
await c.set_administrator_title(m.chat.id, user_id, title)
|
| 334 |
except RPCError as e:
|
| 335 |
LOGGER.error(e)
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
)
|
| 340 |
-
|
| 341 |
await m.reply_text(
|
| 342 |
("{promoter} promoted {promoted} in chat <b>{chat_title}</b>!").format(
|
| 343 |
promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
| 344 |
promoted=(await mention_html(user_first_name, user_id)),
|
| 345 |
chat_title=f"{escape(m.chat.title)} title set to {title}"
|
| 346 |
if title
|
| 347 |
-
else f"{escape(m.chat.title)} title set to
|
| 348 |
),
|
| 349 |
)
|
| 350 |
-
|
| 351 |
# If user is approved, disapprove them as they willbe promoted and get
|
| 352 |
# even more rights
|
| 353 |
if Approve(m.chat.id).check_approve(user_id):
|
| 354 |
Approve(m.chat.id).remove_approve(user_id)
|
| 355 |
-
|
| 356 |
# ----- Add admin to temp cache -----
|
| 357 |
try:
|
| 358 |
inp1 = user_name or user_first_name
|
|
@@ -361,7 +307,6 @@ async def promote_usr(c: Gojo, m: Message):
|
|
| 361 |
ADMIN_CACHE[m.chat.id] = admins_group
|
| 362 |
except KeyError:
|
| 363 |
await admin_cache_reload(m, "promote_key_error")
|
| 364 |
-
|
| 365 |
except ChatAdminRequired:
|
| 366 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|
| 367 |
except RightForbidden:
|
|
@@ -377,26 +322,19 @@ async def promote_usr(c: Gojo, m: Message):
|
|
| 377 |
LOGGER.error(e)
|
| 378 |
LOGGER.error(format_exc())
|
| 379 |
return
|
| 380 |
-
|
| 381 |
-
|
| 382 |
@Gojo.on_message(command("demote") & promote_filter)
|
| 383 |
async def demote_usr(c: Gojo, m: Message):
|
| 384 |
-
|
| 385 |
global ADMIN_CACHE
|
| 386 |
-
|
| 387 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 388 |
await m.reply_text("I can't demote nothing.")
|
| 389 |
return
|
| 390 |
-
|
| 391 |
try:
|
| 392 |
user_id, user_first_name, _ = await extract_user(c, m)
|
| 393 |
except Exception:
|
| 394 |
return
|
| 395 |
-
|
| 396 |
if user_id == Config.BOT_ID:
|
| 397 |
await m.reply_text("Get an admin to demote me!")
|
| 398 |
return
|
| 399 |
-
|
| 400 |
# If user not already admin
|
| 401 |
try:
|
| 402 |
admin_list = {i[0] for i in ADMIN_CACHE[m.chat.id]}
|
|
@@ -404,20 +342,17 @@ async def demote_usr(c: Gojo, m: Message):
|
|
| 404 |
admin_list = {
|
| 405 |
i[0] for i in (await admin_cache_reload(m, "demote_cache_update"))
|
| 406 |
}
|
| 407 |
-
|
| 408 |
if user_id not in admin_list:
|
| 409 |
await m.reply_text(
|
| 410 |
"This user is not an admin, how am I supposed to re-demote them?",
|
| 411 |
)
|
| 412 |
return
|
| 413 |
-
|
| 414 |
try:
|
| 415 |
await m.chat.promote_member(
|
| 416 |
user_id=user_id,
|
| 417 |
privileges=ChatPrivileges(can_manage_chat=False),
|
| 418 |
)
|
| 419 |
LOGGER.info(f"{m.from_user.id} demoted {user_id} in {m.chat.id}")
|
| 420 |
-
|
| 421 |
# ----- Remove admin from cache -----
|
| 422 |
try:
|
| 423 |
admin_list = ADMIN_CACHE[m.chat.id]
|
|
@@ -426,7 +361,6 @@ async def demote_usr(c: Gojo, m: Message):
|
|
| 426 |
ADMIN_CACHE[m.chat.id] = admin_list
|
| 427 |
except (KeyError, StopIteration):
|
| 428 |
await admin_cache_reload(m, "demote_key_stopiter_error")
|
| 429 |
-
|
| 430 |
await m.reply_text(
|
| 431 |
("{demoter} demoted {demoted} in <b>{chat_title}</b>!").format(
|
| 432 |
demoter=(
|
|
@@ -439,7 +373,6 @@ async def demote_usr(c: Gojo, m: Message):
|
|
| 439 |
chat_title=m.chat.title,
|
| 440 |
),
|
| 441 |
)
|
| 442 |
-
|
| 443 |
except ChatAdminRequired:
|
| 444 |
await m.reply_text("I am not admin aroung here.")
|
| 445 |
except RightForbidden:
|
|
@@ -454,20 +387,15 @@ async def demote_usr(c: Gojo, m: Message):
|
|
| 454 |
)
|
| 455 |
LOGGER.error(ef)
|
| 456 |
LOGGER.error(format_exc())
|
| 457 |
-
|
| 458 |
return
|
| 459 |
-
|
| 460 |
-
|
| 461 |
@Gojo.on_message(command("invitelink"))
|
| 462 |
async def get_invitelink(c: Gojo, m: Message):
|
| 463 |
# Bypass the bot devs, sudos and owner
|
| 464 |
if m.from_user.id not in DEV_LEVEL:
|
| 465 |
user = await m.chat.get_member(m.from_user.id)
|
| 466 |
-
|
| 467 |
if not user.privileges.can_invite_users and user.status != CMS.OWNER:
|
| 468 |
await m.reply_text(text="You don't have rights to invite users....")
|
| 469 |
return False
|
| 470 |
-
|
| 471 |
try:
|
| 472 |
link = await c.export_chat_invite_link(m.chat.id)
|
| 473 |
await m.reply_text(
|
|
@@ -487,23 +415,17 @@ async def get_invitelink(c: Gojo, m: Message):
|
|
| 487 |
)
|
| 488 |
LOGGER.error(ef)
|
| 489 |
LOGGER.error(format_exc())
|
| 490 |
-
|
| 491 |
return
|
| 492 |
-
|
| 493 |
-
|
| 494 |
@Gojo.on_message(command("setgtitle") & admin_filter)
|
| 495 |
async def setgtitle(_, m: Message):
|
| 496 |
user = await m.chat.get_member(m.from_user.id)
|
| 497 |
-
|
| 498 |
if not user.privileges.can_change_info and user.status != CMS.OWNER:
|
| 499 |
await m.reply_text(
|
| 500 |
"You don't have enough permission to use this command!",
|
| 501 |
)
|
| 502 |
return False
|
| 503 |
-
|
| 504 |
if len(m.command) < 1:
|
| 505 |
return await m.reply_text("Please read /help for using it!")
|
| 506 |
-
|
| 507 |
gtit = m.text.split(None, 1)[1]
|
| 508 |
try:
|
| 509 |
await m.chat.set_title(gtit)
|
|
@@ -512,21 +434,16 @@ async def setgtitle(_, m: Message):
|
|
| 512 |
return await m.reply_text(
|
| 513 |
f"Successfully Changed Group Title From {m.chat.title} To {gtit}",
|
| 514 |
)
|
| 515 |
-
|
| 516 |
-
|
| 517 |
@Gojo.on_message(command("setgdes") & admin_filter)
|
| 518 |
async def setgdes(_, m: Message):
|
| 519 |
-
|
| 520 |
user = await m.chat.get_member(m.from_user.id)
|
| 521 |
if not user.privileges.can_change_info and user.status != CMS.OWNER:
|
| 522 |
await m.reply_text(
|
| 523 |
"You don't have enough permission to use this command!",
|
| 524 |
)
|
| 525 |
return False
|
| 526 |
-
|
| 527 |
if len(m.command) < 1:
|
| 528 |
return await m.reply_text("Please read /help for using it!")
|
| 529 |
-
|
| 530 |
desp = m.text.split(None, 1)[1]
|
| 531 |
try:
|
| 532 |
await m.chat.set_description(desp)
|
|
@@ -535,21 +452,16 @@ async def setgdes(_, m: Message):
|
|
| 535 |
return await m.reply_text(
|
| 536 |
f"Successfully Changed Group description From {m.chat.description} To {desp}",
|
| 537 |
)
|
| 538 |
-
|
| 539 |
-
|
| 540 |
@Gojo.on_message(command("title") & admin_filter)
|
| 541 |
async def set_user_title(c: Gojo, m: Message):
|
| 542 |
-
|
| 543 |
user = await m.chat.get_member(m.from_user.id)
|
| 544 |
if not user.privileges.can_promote_members and user.status != CMS.OWNER:
|
| 545 |
await m.reply_text(
|
| 546 |
"You don't have enough permission to use this command!",
|
| 547 |
)
|
| 548 |
return False
|
| 549 |
-
|
| 550 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 551 |
return await m.reply_text("To whom??")
|
| 552 |
-
|
| 553 |
if m.reply_to_message:
|
| 554 |
if len(m.text.split()) >= 2:
|
| 555 |
reason = m.text.split(None, 1)[1]
|
|
@@ -560,16 +472,12 @@ async def set_user_title(c: Gojo, m: Message):
|
|
| 560 |
user_id, _, _ = await extract_user(c, m)
|
| 561 |
except Exception:
|
| 562 |
return
|
| 563 |
-
|
| 564 |
if not user_id:
|
| 565 |
return await m.reply_text("Cannot find user!")
|
| 566 |
-
|
| 567 |
if user_id == Config.BOT_ID:
|
| 568 |
return await m.reply_text("Huh, why ?")
|
| 569 |
-
|
| 570 |
if not reason:
|
| 571 |
return await m.reply_text("Read /help please!")
|
| 572 |
-
|
| 573 |
from_user = await c.get_users(user_id)
|
| 574 |
title = reason
|
| 575 |
try:
|
|
@@ -579,8 +487,6 @@ async def set_user_title(c: Gojo, m: Message):
|
|
| 579 |
return await m.reply_text(
|
| 580 |
f"Successfully Changed {from_user.mention}'s Admin Title To {title}",
|
| 581 |
)
|
| 582 |
-
|
| 583 |
-
|
| 584 |
@Gojo.on_message(command("setgpic") & admin_filter)
|
| 585 |
async def setgpic(c: Gojo, m: Message):
|
| 586 |
user = await m.chat.get_member(m.from_user.id)
|
|
@@ -601,10 +507,7 @@ async def setgpic(c: Gojo, m: Message):
|
|
| 601 |
return await m.reply_text(f"Error: {e}")
|
| 602 |
await m.reply_text("Successfully Changed Group Photo!")
|
| 603 |
remove(photo)
|
| 604 |
-
|
| 605 |
-
|
| 606 |
__PLUGIN__ = "admin"
|
| 607 |
-
|
| 608 |
__alt_name__ = [
|
| 609 |
"admins",
|
| 610 |
"promote",
|
|
@@ -618,13 +521,10 @@ __alt_name__ = [
|
|
| 618 |
"setgdes",
|
| 619 |
"zombies",
|
| 620 |
]
|
| 621 |
-
|
| 622 |
__HELP__ = """
|
| 623 |
**Admin**
|
| 624 |
-
|
| 625 |
**User Commands:**
|
| 626 |
• /adminlist: List all the admins in the Group.
|
| 627 |
-
|
| 628 |
**Admin only:**
|
| 629 |
• /invitelink: Gets chat invitelink.
|
| 630 |
• /promote: Promotes the user replied to or tagged (supports with title).
|
|
@@ -639,6 +539,5 @@ __HELP__ = """
|
|
| 639 |
• /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
| 640 |
• /disabled: List the disabled commands in this chat.
|
| 641 |
• /enableall: enable all disabled commands.
|
| 642 |
-
|
| 643 |
**Example:**
|
| 644 |
`/promote @username`: this promotes a user to admin."""
|
|
|
|
| 5 |
from Powers.vars import Config
|
| 6 |
from traceback import format_exc
|
| 7 |
from Powers.bot_class import Gojo
|
| 8 |
+
from pyrogram.types import Message, ChatPrivileges
|
| 9 |
from Powers.utils.parser import mention_html
|
| 10 |
from Powers.database.approve_db import Approve
|
| 11 |
from Powers.database.reporting_db import Reporting
|
| 12 |
from Powers.utils.extract_user import extract_user
|
|
|
|
| 13 |
from pyrogram.enums import ChatType, ChatMemberStatus as CMS
|
| 14 |
from Powers import LOGGER, OWNER_ID, DEV_USERS, SUPPORT_GROUP, SUPPORT_STAFF
|
| 15 |
from Powers.utils.caching import (
|
|
|
|
| 19 |
from pyrogram.errors import (
|
| 20 |
RPCError, FloodWait, RightForbidden, UserAdminInvalid, ChatAdminRequired,
|
| 21 |
ChatAdminInviteRequired)
|
|
|
|
|
|
|
| 22 |
@Gojo.on_message(command("adminlist"))
|
| 23 |
async def adminlist_show(_, m: Message):
|
| 24 |
global ADMIN_CACHE
|
|
|
|
| 25 |
if m.chat.type != ChatType.SUPERGROUP:
|
| 26 |
return await m.reply_text(
|
| 27 |
text="This command is made to be used in groups only!",
|
|
|
|
| 33 |
except KeyError:
|
| 34 |
admin_list = await admin_cache_reload(m, "adminlist")
|
| 35 |
note = "<i>Note:</i> These are up-to-date values!"
|
|
|
|
| 36 |
adminstr = f"Admins in <b>{m.chat.title}</b>:" + "\n\n"
|
|
|
|
| 37 |
bot_admins = [i for i in admin_list if (i[1].lower()).endswith("bot")]
|
| 38 |
user_admins = [i for i in admin_list if not (i[1].lower()).endswith("bot")]
|
|
|
|
| 39 |
# format is like: (user_id, username/name,anonyamous or not)
|
| 40 |
mention_users = [
|
| 41 |
(
|
|
|
|
| 47 |
if not admin[2] # if non-anonyamous admin
|
| 48 |
]
|
| 49 |
mention_users.sort(key=lambda x: x[1])
|
|
|
|
| 50 |
mention_bots = [
|
| 51 |
(
|
| 52 |
admin[1]
|
|
|
|
| 56 |
for admin in bot_admins
|
| 57 |
]
|
| 58 |
mention_bots.sort(key=lambda x: x[1])
|
|
|
|
| 59 |
adminstr += "<b>User Admins:</b>\n"
|
| 60 |
adminstr += "\n".join(f"- {i}" for i in mention_users)
|
| 61 |
adminstr += "\n\n<b>Bots:</b>\n"
|
| 62 |
adminstr += "\n".join(f"- {i}" for i in mention_bots)
|
|
|
|
| 63 |
await m.reply_text(adminstr + "\n\n" + note)
|
| 64 |
LOGGER.info(f"Adminlist cmd use in {m.chat.id} by {m.from_user.id}")
|
|
|
|
| 65 |
except Exception as ef:
|
| 66 |
if str(ef) == str(m.chat.id):
|
| 67 |
await m.reply_text(text="Use /admincache to reload admins!")
|
|
|
|
| 72 |
)
|
| 73 |
LOGGER.error(ef)
|
| 74 |
LOGGER.error(format_exc())
|
|
|
|
| 75 |
return
|
|
|
|
|
|
|
| 76 |
@Gojo.on_message(command("zombies") & owner_filter)
|
| 77 |
async def zombie_clean(c: Gojo, m: Message):
|
|
|
|
| 78 |
zombie = 0
|
|
|
|
| 79 |
wait = await m.reply_text("Searching ... and banning ...")
|
| 80 |
async for member in c.get_chat_members(m.chat.id):
|
| 81 |
if member.user.is_deleted:
|
|
|
|
| 91 |
return await wait.edit_text(
|
| 92 |
text=f"<b>{zombie}</b> Zombies found and has been banned!",
|
| 93 |
)
|
|
|
|
|
|
|
| 94 |
@Gojo.on_message(command("admincache"))
|
| 95 |
async def reload_admins(_, m: Message):
|
| 96 |
global TEMP_ADMIN_CACHE_BLOCK
|
|
|
|
| 97 |
if m.chat.type != ChatType.SUPERGROUP:
|
| 98 |
return await m.reply_text(
|
| 99 |
"This command is made to be used in groups only!",
|
| 100 |
)
|
|
|
|
| 101 |
if (
|
| 102 |
(m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
|
| 103 |
and (m.from_user.id not in SUPPORT_STAFF)
|
|
|
|
| 105 |
):
|
| 106 |
await m.reply_text("Can only reload admin cache once per 10 mins!")
|
| 107 |
return
|
|
|
|
| 108 |
try:
|
| 109 |
await admin_cache_reload(m, "admincache")
|
| 110 |
TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "manualblock"
|
|
|
|
| 117 |
LOGGER.error(ef)
|
| 118 |
LOGGER.error(format_exc())
|
| 119 |
return
|
|
|
|
|
|
|
| 120 |
@Gojo.on_message(filters.regex(r"^(?i)@admin(s)?") & filters.group)
|
| 121 |
async def tag_admins(_, m: Message):
|
| 122 |
db = Reporting(m.chat.id)
|
| 123 |
if not db.get_settings():
|
| 124 |
return
|
|
|
|
| 125 |
try:
|
| 126 |
admin_list = ADMIN_CACHE[m.chat.id]
|
| 127 |
except KeyError:
|
| 128 |
admin_list = await admin_cache_reload(m, "adminlist")
|
|
|
|
| 129 |
user_admins = [i for i in admin_list if not (i[1].lower()).endswith("bot")]
|
| 130 |
mention_users = [(await mention_html("\u2063", admin[0])) for admin in user_admins]
|
| 131 |
mention_users.sort(key=lambda x: x[1])
|
|
|
|
| 136 |
f" reported the message to admins!{mention_str}"
|
| 137 |
),
|
| 138 |
)
|
| 139 |
+
@Gojo.on_message(command("fullpromote") & promote_filter)
|
|
|
|
|
|
|
| 140 |
async def fullpromote_usr(c: Gojo, m: Message):
|
| 141 |
global ADMIN_CACHE
|
|
|
|
| 142 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 143 |
await m.reply_text(
|
| 144 |
text="I can't promote nothing! Give me an username or user id or atleast reply to that user"
|
| 145 |
)
|
| 146 |
return
|
|
|
|
| 147 |
try:
|
| 148 |
user_id, user_first_name, user_name = await extract_user(c, m)
|
| 149 |
except Exception:
|
| 150 |
return
|
|
|
|
| 151 |
bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
|
|
|
|
| 152 |
if user_id == Config.BOT_ID:
|
| 153 |
await m.reply_text("Huh, how can I even promote myself?")
|
| 154 |
return
|
|
|
|
| 155 |
if not bot.privileges.can_promote_members:
|
| 156 |
return await m.reply_text(
|
| 157 |
"I don't have enough permissions!",
|
| 158 |
) # This should be here
|
|
|
|
| 159 |
user = await c.get_chat_member(m.chat.id, m.from_user.id)
|
| 160 |
if m.from_user.id != OWNER_ID and user.status != CMS.OWNER:
|
| 161 |
return await m.reply_text("This command can only be used by chat owner.")
|
|
|
|
| 166 |
admin_list = {
|
| 167 |
i[0] for i in (await admin_cache_reload(m, "promote_cache_update"))
|
| 168 |
}
|
|
|
|
| 169 |
if user_id in admin_list:
|
| 170 |
await m.reply_text(
|
| 171 |
"This user is already an admin, how am I supposed to re-promote them?",
|
| 172 |
)
|
| 173 |
return
|
| 174 |
+
try:
|
| 175 |
+
await m.chat.promote_member(user_id=user_id, privileges=bot.privileges)
|
| 176 |
+
if not m.chat.type == ChatType.SUPERGROUP:
|
| 177 |
+
title = "Gojo" # Default fullpromote title
|
|
|
|
| 178 |
if len(m.text.split()) == 3 and not m.reply_to_message:
|
| 179 |
title = m.text.split()[2]
|
| 180 |
elif len(m.text.split()) == 2 and m.reply_to_message:
|
|
|
|
| 186 |
await c.set_administrator_title(m.chat.id, user_id, title)
|
| 187 |
except RPCError as e:
|
| 188 |
LOGGER.error(e)
|
|
|
|
| 189 |
LOGGER.info(
|
| 190 |
f"{m.from_user.id} fullpromoted {user_id} in {m.chat.id} with title '{title}'",
|
| 191 |
)
|
|
|
|
| 192 |
await m.reply_text(
|
| 193 |
+
("{promoter} promoted {promoted} in chat <b>{chat_title}</b> with full rights!").format(
|
| 194 |
promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
| 195 |
promoted=(await mention_html(user_first_name, user_id)),
|
| 196 |
chat_title=f"{escape(m.chat.title)} title set to {title}"
|
| 197 |
if title
|
| 198 |
+
else f"{escape(m.chat.title)} title set to Gojo",
|
| 199 |
),
|
| 200 |
)
|
|
|
|
| 201 |
# If user is approved, disapprove them as they willbe promoted and get
|
| 202 |
# even more rights
|
| 203 |
if Approve(m.chat.id).check_approve(user_id):
|
| 204 |
Approve(m.chat.id).remove_approve(user_id)
|
|
|
|
| 205 |
# ----- Add admin to temp cache -----
|
| 206 |
try:
|
| 207 |
inp1 = user_name or user_first_name
|
|
|
|
| 210 |
ADMIN_CACHE[m.chat.id] = admins_group
|
| 211 |
except KeyError:
|
| 212 |
await admin_cache_reload(m, "promote_key_error")
|
|
|
|
| 213 |
except ChatAdminRequired:
|
| 214 |
await m.reply_text(text="I'm not admin or I don't have rights......")
|
| 215 |
except RightForbidden:
|
|
|
|
| 225 |
LOGGER.error(e)
|
| 226 |
LOGGER.error(format_exc())
|
| 227 |
return
|
|
|
|
|
|
|
| 228 |
@Gojo.on_message(command("promote") & promote_filter)
|
| 229 |
async def promote_usr(c: Gojo, m: Message):
|
|
|
|
| 230 |
global ADMIN_CACHE
|
|
|
|
| 231 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 232 |
await m.reply_text(
|
| 233 |
text="I can't promote nothing!......reply to user to promote him/her...."
|
| 234 |
)
|
| 235 |
return
|
|
|
|
| 236 |
try:
|
| 237 |
user_id, user_first_name, user_name = await extract_user(c, m)
|
| 238 |
except Exception:
|
| 239 |
return
|
|
|
|
| 240 |
bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
|
|
|
|
| 241 |
if user_id == Config.BOT_ID:
|
| 242 |
await m.reply_text("Huh, how can I even promote myself?")
|
| 243 |
return
|
|
|
|
| 244 |
if not bot.privileges.can_promote_members:
|
| 245 |
return await m.reply_text(
|
| 246 |
"I don't have enough permissions",
|
|
|
|
| 252 |
admin_list = {
|
| 253 |
i[0] for i in (await admin_cache_reload(m, "promote_cache_update"))
|
| 254 |
}
|
|
|
|
| 255 |
if user_id in admin_list:
|
| 256 |
await m.reply_text(
|
| 257 |
"This user is already an admin, how am I supposed to re-promote them?",
|
| 258 |
)
|
| 259 |
return
|
|
|
|
| 260 |
try:
|
| 261 |
await m.chat.promote_member(
|
| 262 |
user_id=user_id,
|
|
|
|
| 270 |
can_manage_video_chats=bot.privileges.can_manage_video_chats,
|
| 271 |
),
|
| 272 |
)
|
|
|
|
|
|
|
| 273 |
if not m.chat.type == ChatType.SUPERGROUP:
|
| 274 |
+
title = "Itadori" # Deafult title
|
| 275 |
if len(m.text.split()) == 3 and not m.reply_to_message:
|
| 276 |
title = m.text.split()[2]
|
| 277 |
elif len(m.text.split()) == 2 and m.reply_to_message:
|
| 278 |
title = m.text.split()[1]
|
| 279 |
if title and len(title) > 16:
|
| 280 |
title = title[0:16] # trim title to 16 characters
|
| 281 |
+
|
| 282 |
try:
|
| 283 |
await c.set_administrator_title(m.chat.id, user_id, title)
|
| 284 |
except RPCError as e:
|
| 285 |
LOGGER.error(e)
|
| 286 |
+
LOGGER.info(
|
| 287 |
+
f"{m.from_user.id} promoted {user_id} in {m.chat.id} with title '{title}'",
|
| 288 |
+
)
|
|
|
|
|
|
|
| 289 |
await m.reply_text(
|
| 290 |
("{promoter} promoted {promoted} in chat <b>{chat_title}</b>!").format(
|
| 291 |
promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
|
| 292 |
promoted=(await mention_html(user_first_name, user_id)),
|
| 293 |
chat_title=f"{escape(m.chat.title)} title set to {title}"
|
| 294 |
if title
|
| 295 |
+
else f"{escape(m.chat.title)} title set to Itadori",
|
| 296 |
),
|
| 297 |
)
|
|
|
|
| 298 |
# If user is approved, disapprove them as they willbe promoted and get
|
| 299 |
# even more rights
|
| 300 |
if Approve(m.chat.id).check_approve(user_id):
|
| 301 |
Approve(m.chat.id).remove_approve(user_id)
|
|
|
|
| 302 |
# ----- Add admin to temp cache -----
|
| 303 |
try:
|
| 304 |
inp1 = user_name or user_first_name
|
|
|
|
| 307 |
ADMIN_CACHE[m.chat.id] = admins_group
|
| 308 |
except KeyError:
|
| 309 |
await admin_cache_reload(m, "promote_key_error")
|
|
|
|
| 310 |
except ChatAdminRequired:
|
| 311 |
await m.reply_text(text="I'm not admin or I don't have rights.")
|
| 312 |
except RightForbidden:
|
|
|
|
| 322 |
LOGGER.error(e)
|
| 323 |
LOGGER.error(format_exc())
|
| 324 |
return
|
|
|
|
|
|
|
| 325 |
@Gojo.on_message(command("demote") & promote_filter)
|
| 326 |
async def demote_usr(c: Gojo, m: Message):
|
|
|
|
| 327 |
global ADMIN_CACHE
|
|
|
|
| 328 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 329 |
await m.reply_text("I can't demote nothing.")
|
| 330 |
return
|
|
|
|
| 331 |
try:
|
| 332 |
user_id, user_first_name, _ = await extract_user(c, m)
|
| 333 |
except Exception:
|
| 334 |
return
|
|
|
|
| 335 |
if user_id == Config.BOT_ID:
|
| 336 |
await m.reply_text("Get an admin to demote me!")
|
| 337 |
return
|
|
|
|
| 338 |
# If user not already admin
|
| 339 |
try:
|
| 340 |
admin_list = {i[0] for i in ADMIN_CACHE[m.chat.id]}
|
|
|
|
| 342 |
admin_list = {
|
| 343 |
i[0] for i in (await admin_cache_reload(m, "demote_cache_update"))
|
| 344 |
}
|
|
|
|
| 345 |
if user_id not in admin_list:
|
| 346 |
await m.reply_text(
|
| 347 |
"This user is not an admin, how am I supposed to re-demote them?",
|
| 348 |
)
|
| 349 |
return
|
|
|
|
| 350 |
try:
|
| 351 |
await m.chat.promote_member(
|
| 352 |
user_id=user_id,
|
| 353 |
privileges=ChatPrivileges(can_manage_chat=False),
|
| 354 |
)
|
| 355 |
LOGGER.info(f"{m.from_user.id} demoted {user_id} in {m.chat.id}")
|
|
|
|
| 356 |
# ----- Remove admin from cache -----
|
| 357 |
try:
|
| 358 |
admin_list = ADMIN_CACHE[m.chat.id]
|
|
|
|
| 361 |
ADMIN_CACHE[m.chat.id] = admin_list
|
| 362 |
except (KeyError, StopIteration):
|
| 363 |
await admin_cache_reload(m, "demote_key_stopiter_error")
|
|
|
|
| 364 |
await m.reply_text(
|
| 365 |
("{demoter} demoted {demoted} in <b>{chat_title}</b>!").format(
|
| 366 |
demoter=(
|
|
|
|
| 373 |
chat_title=m.chat.title,
|
| 374 |
),
|
| 375 |
)
|
|
|
|
| 376 |
except ChatAdminRequired:
|
| 377 |
await m.reply_text("I am not admin aroung here.")
|
| 378 |
except RightForbidden:
|
|
|
|
| 387 |
)
|
| 388 |
LOGGER.error(ef)
|
| 389 |
LOGGER.error(format_exc())
|
|
|
|
| 390 |
return
|
|
|
|
|
|
|
| 391 |
@Gojo.on_message(command("invitelink"))
|
| 392 |
async def get_invitelink(c: Gojo, m: Message):
|
| 393 |
# Bypass the bot devs, sudos and owner
|
| 394 |
if m.from_user.id not in DEV_LEVEL:
|
| 395 |
user = await m.chat.get_member(m.from_user.id)
|
|
|
|
| 396 |
if not user.privileges.can_invite_users and user.status != CMS.OWNER:
|
| 397 |
await m.reply_text(text="You don't have rights to invite users....")
|
| 398 |
return False
|
|
|
|
| 399 |
try:
|
| 400 |
link = await c.export_chat_invite_link(m.chat.id)
|
| 401 |
await m.reply_text(
|
|
|
|
| 415 |
)
|
| 416 |
LOGGER.error(ef)
|
| 417 |
LOGGER.error(format_exc())
|
|
|
|
| 418 |
return
|
|
|
|
|
|
|
| 419 |
@Gojo.on_message(command("setgtitle") & admin_filter)
|
| 420 |
async def setgtitle(_, m: Message):
|
| 421 |
user = await m.chat.get_member(m.from_user.id)
|
|
|
|
| 422 |
if not user.privileges.can_change_info and user.status != CMS.OWNER:
|
| 423 |
await m.reply_text(
|
| 424 |
"You don't have enough permission to use this command!",
|
| 425 |
)
|
| 426 |
return False
|
|
|
|
| 427 |
if len(m.command) < 1:
|
| 428 |
return await m.reply_text("Please read /help for using it!")
|
|
|
|
| 429 |
gtit = m.text.split(None, 1)[1]
|
| 430 |
try:
|
| 431 |
await m.chat.set_title(gtit)
|
|
|
|
| 434 |
return await m.reply_text(
|
| 435 |
f"Successfully Changed Group Title From {m.chat.title} To {gtit}",
|
| 436 |
)
|
|
|
|
|
|
|
| 437 |
@Gojo.on_message(command("setgdes") & admin_filter)
|
| 438 |
async def setgdes(_, m: Message):
|
|
|
|
| 439 |
user = await m.chat.get_member(m.from_user.id)
|
| 440 |
if not user.privileges.can_change_info and user.status != CMS.OWNER:
|
| 441 |
await m.reply_text(
|
| 442 |
"You don't have enough permission to use this command!",
|
| 443 |
)
|
| 444 |
return False
|
|
|
|
| 445 |
if len(m.command) < 1:
|
| 446 |
return await m.reply_text("Please read /help for using it!")
|
|
|
|
| 447 |
desp = m.text.split(None, 1)[1]
|
| 448 |
try:
|
| 449 |
await m.chat.set_description(desp)
|
|
|
|
| 452 |
return await m.reply_text(
|
| 453 |
f"Successfully Changed Group description From {m.chat.description} To {desp}",
|
| 454 |
)
|
|
|
|
|
|
|
| 455 |
@Gojo.on_message(command("title") & admin_filter)
|
| 456 |
async def set_user_title(c: Gojo, m: Message):
|
|
|
|
| 457 |
user = await m.chat.get_member(m.from_user.id)
|
| 458 |
if not user.privileges.can_promote_members and user.status != CMS.OWNER:
|
| 459 |
await m.reply_text(
|
| 460 |
"You don't have enough permission to use this command!",
|
| 461 |
)
|
| 462 |
return False
|
|
|
|
| 463 |
if len(m.text.split()) == 1 and not m.reply_to_message:
|
| 464 |
return await m.reply_text("To whom??")
|
|
|
|
| 465 |
if m.reply_to_message:
|
| 466 |
if len(m.text.split()) >= 2:
|
| 467 |
reason = m.text.split(None, 1)[1]
|
|
|
|
| 472 |
user_id, _, _ = await extract_user(c, m)
|
| 473 |
except Exception:
|
| 474 |
return
|
|
|
|
| 475 |
if not user_id:
|
| 476 |
return await m.reply_text("Cannot find user!")
|
|
|
|
| 477 |
if user_id == Config.BOT_ID:
|
| 478 |
return await m.reply_text("Huh, why ?")
|
|
|
|
| 479 |
if not reason:
|
| 480 |
return await m.reply_text("Read /help please!")
|
|
|
|
| 481 |
from_user = await c.get_users(user_id)
|
| 482 |
title = reason
|
| 483 |
try:
|
|
|
|
| 487 |
return await m.reply_text(
|
| 488 |
f"Successfully Changed {from_user.mention}'s Admin Title To {title}",
|
| 489 |
)
|
|
|
|
|
|
|
| 490 |
@Gojo.on_message(command("setgpic") & admin_filter)
|
| 491 |
async def setgpic(c: Gojo, m: Message):
|
| 492 |
user = await m.chat.get_member(m.from_user.id)
|
|
|
|
| 507 |
return await m.reply_text(f"Error: {e}")
|
| 508 |
await m.reply_text("Successfully Changed Group Photo!")
|
| 509 |
remove(photo)
|
|
|
|
|
|
|
| 510 |
__PLUGIN__ = "admin"
|
|
|
|
| 511 |
__alt_name__ = [
|
| 512 |
"admins",
|
| 513 |
"promote",
|
|
|
|
| 521 |
"setgdes",
|
| 522 |
"zombies",
|
| 523 |
]
|
|
|
|
| 524 |
__HELP__ = """
|
| 525 |
**Admin**
|
|
|
|
| 526 |
**User Commands:**
|
| 527 |
• /adminlist: List all the admins in the Group.
|
|
|
|
| 528 |
**Admin only:**
|
| 529 |
• /invitelink: Gets chat invitelink.
|
| 530 |
• /promote: Promotes the user replied to or tagged (supports with title).
|
|
|
|
| 539 |
• /disabledel <yes/off>: Delete disabled commands when used by non-admins.
|
| 540 |
• /disabled: List the disabled commands in this chat.
|
| 541 |
• /enableall: enable all disabled commands.
|
|
|
|
| 542 |
**Example:**
|
| 543 |
`/promote @username`: this promotes a user to admin."""
|