mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-04 19:24:51 +00:00
Catch error admin permission in warn CMD
Will add another in another time Signed-off-by: Yasir Aris M <git@yasir.id>
This commit is contained in:
parent
ff988a9cc4
commit
4a49a32c44
1 changed files with 7 additions and 4 deletions
|
|
@ -620,9 +620,12 @@ async def warn_user(client, message, strings):
|
||||||
if message.command[0][0] == "d":
|
if message.command[0][0] == "d":
|
||||||
await message.reply_to_message.delete()
|
await message.reply_to_message.delete()
|
||||||
if warns >= 2:
|
if warns >= 2:
|
||||||
await message.chat.ban_member(user_id)
|
try:
|
||||||
await message.reply_text(strings("exceed_warn_msg").format(mention=mention))
|
await message.chat.ban_member(user_id)
|
||||||
await remove_warns(chat_id, await int_to_alpha(user_id))
|
await message.reply_msg(strings("exceed_warn_msg").format(mention=mention))
|
||||||
|
await remove_warns(chat_id, await int_to_alpha(user_id))
|
||||||
|
except ChatAdminRequired:
|
||||||
|
await message.reply_msg(strings("no_ban_permission"))
|
||||||
else:
|
else:
|
||||||
warn = {"warns": warns + 1}
|
warn = {"warns": warns + 1}
|
||||||
msg = strings("warn_msg").format(
|
msg = strings("warn_msg").format(
|
||||||
|
|
@ -631,7 +634,7 @@ async def warn_user(client, message, strings):
|
||||||
reas=reason or "No Reason Provided.",
|
reas=reason or "No Reason Provided.",
|
||||||
twarn=warns + 1,
|
twarn=warns + 1,
|
||||||
)
|
)
|
||||||
await message.reply_text(msg, reply_markup=keyboard)
|
await message.reply_msg(msg, reply_markup=keyboard)
|
||||||
await add_warn(chat_id, await int_to_alpha(user_id), warn)
|
await add_warn(chat_id, await int_to_alpha(user_id), warn)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue