From 9adf448701ae4fb98bf7a4e33da0a6586bf1f6f7 Mon Sep 17 00:00:00 2001 From: yasirarism <55983182+yasirarism@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:25:12 +0700 Subject: [PATCH] Fix memify for pillow v10 and minor fix (#129) * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Update ban_user_or_chat.py * Fix memify for pillow v10 --- misskaty/plugins/ban_user_or_chat.py | 21 +++++++++------------ misskaty/plugins/fun.py | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/misskaty/plugins/ban_user_or_chat.py b/misskaty/plugins/ban_user_or_chat.py index 1b091032..624ea558 100644 --- a/misskaty/plugins/ban_user_or_chat.py +++ b/misskaty/plugins/ban_user_or_chat.py @@ -8,21 +8,18 @@ from misskaty.helper.localization import use_chat_lang from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, SUPPORT_CHAT -@app.on_message(filters.incoming, group=-1) +@app.on_message(filters.incoming, group=-5) async def ban_reply(self: Client, ctx: Message): if not ctx.from_user: return - try: - ban = await db.get_ban_status(ctx.from_user.id) - if (ban.get("is_banned") and ctx.chat.type.value == "private") or ( - ban.get("is_banned") and ctx.chat.type.value == "supergroup" and ctx.command - ): - await ctx.reply_msg( - f'I am sorry, You are banned to use Me. \nBan Reason: {ban["ban_reason"]}' - ) - await ctx.stop_propagation() - except: - await ctx.continue_propagation() + ban = await db.get_ban_status(ctx.from_user.id) + if (ban.get("is_banned") and ctx.chat.type.value == "private") or ( + ban.get("is_banned") and ctx.chat.type.value == "supergroup" and ctx.command + ): + await ctx.reply_msg( + f'I am sorry, You are banned to use Me. \nBan Reason: {ban["ban_reason"]}' + ) + await ctx.stop_propagation() @app.on_message(filters.group & filters.incoming, group=-2) diff --git a/misskaty/plugins/fun.py b/misskaty/plugins/fun.py index 2c3322b8..ddc90ac7 100644 --- a/misskaty/plugins/fun.py +++ b/misskaty/plugins/fun.py @@ -28,7 +28,7 @@ async def draw_meme_text(image_path, text): current_h, pad = 10, 5 if upper_text: for u_text in textwrap.wrap(upper_text, width=15): - u_width, u_height = draw.textsize(u_text, font=m_font) + u_width, u_height = draw.getbbox(u_text, font=m_font) draw.text( xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)), @@ -72,7 +72,7 @@ async def draw_meme_text(image_path, text): current_h += u_height + pad if lower_text: for l_text in textwrap.wrap(lower_text, width=15): - u_width, u_height = draw.textsize(l_text, font=m_font) + u_width, u_height = draw.getbbox(l_text, font=m_font) draw.text( xy=(