mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +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":
|
||||
await message.reply_to_message.delete()
|
||||
if warns >= 2:
|
||||
await message.chat.ban_member(user_id)
|
||||
await message.reply_text(strings("exceed_warn_msg").format(mention=mention))
|
||||
await remove_warns(chat_id, await int_to_alpha(user_id))
|
||||
try:
|
||||
await message.chat.ban_member(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:
|
||||
warn = {"warns": warns + 1}
|
||||
msg = strings("warn_msg").format(
|
||||
|
|
@ -631,7 +634,7 @@ async def warn_user(client, message, strings):
|
|||
reas=reason or "No Reason Provided.",
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue