Try fix unban button

This commit is contained in:
yasirarism 2023-06-16 03:45:38 +00:00 committed by GitHub
parent 213938f2f8
commit e1112e7a32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View file

@ -28,7 +28,7 @@ MOD_NOLOAD = ["subscene_dl"]
HELPABLE = {}
cleanmode = {}
botStartTime = time.time()
misskaty_version = "v2.4 - Stable"
misskaty_version = "v2.5 - Stable"
pymonclient = MongoClient(DATABASE_URI)

View file

@ -218,7 +218,7 @@ async def banFunc(client, message, strings):
@adminsOnly("can_restrict_members")
@ratelimiter
@use_chat_lang()
async def unban_func(_, message, strings):
async def unban_func(self, message, strings):
if not message.from_user:
return
# we don't need reasons for unban, also, we
@ -231,7 +231,7 @@ async def unban_func(_, message, strings):
return await message.reply_text(strings("unban_channel_err"))
if len(message.command) == 2:
user = message.text.split(None, 1)[1]
user = int(message.text.split(None, 1)[1])
elif len(message.command) == 1 and reply:
user = message.reply_to_message.from_user.id
else:
@ -544,7 +544,7 @@ async def warn_user(client, message, strings):
get_warn(chat_id, await int_to_alpha(user_id)),
)
mention = user.mention
keyboard = ikb({strings("rmwarn_btn"): f"unwarn_{user_id}"})
keyboard = ikb({strings("rm_warn_btn"): f"unwarn_{user_id}"})
warns = warns["warns"] if warns else 0
if message.command[0][0] == "d":
await message.reply_to_message.delete()
@ -620,12 +620,15 @@ async def unban_user(_, cq, strings):
strings("no_permission_error").format(permissions=permission),
show_alert=True,
)
user_id = cq.data.split("_")[1]
user_id = int(cq.data.split("_")[1])
text = cq.message.text.markdown
text = f"~~{text}~~\n\n"
text += strings("unban_msg").format(mention=from_user.mention)
await cq.message.chat.unban_member(user_id)
await cq.message.edit(text)
try:
await cq.message.chat.unban_member(user_id)
await cq.message.edit(text)
except Exception as e:
await cq.answer(str(e))
# Remove Warn

View file

@ -185,9 +185,9 @@ async def url_detector(_, message):
permissions = await current_chat_permissions(chat_id)
if "can_add_web_page_previews" not in permissions:
try:
await message.delete()
await message.delete_msg()
except Exception:
await message.reply_text(
await message.reply_msg(
"This message contains a URL, "
+ "but i don't have enough permissions to delete it"
)

View file

@ -236,7 +236,7 @@ async def getDataSavefilm21(msg, kueri, CurrentPage, user, strings):
data = await http.get(f"{web['savefilm21']}/?s={kueri}", headers=headers, follow_redirects=True)
except Exception as err:
await msg.edit_msg(strings("err_getweb").format(err=err))
return None, None
return None, 0, None
text = BeautifulSoup(data, "lxml")
entry = text.find_all(class_="entry-header")
if "Tidak Ditemukan" in entry[0].text: