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
This commit is contained in:
yasirarism 2023-07-03 17:25:12 +07:00 committed by GitHub
parent e335d36c5d
commit 9adf448701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 14 deletions

View file

@ -8,21 +8,18 @@ from misskaty.helper.localization import use_chat_lang
from misskaty.vars import COMMAND_HANDLER, LOG_CHANNEL, SUDO, SUPPORT_CHAT 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): async def ban_reply(self: Client, ctx: Message):
if not ctx.from_user: if not ctx.from_user:
return return
try: ban = await db.get_ban_status(ctx.from_user.id)
ban = await db.get_ban_status(ctx.from_user.id) if (ban.get("is_banned") and ctx.chat.type.value == "private") or (
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
ban.get("is_banned") and ctx.chat.type.value == "supergroup" and ctx.command ):
): await ctx.reply_msg(
await ctx.reply_msg( f'I am sorry, You are banned to use Me. \nBan Reason: {ban["ban_reason"]}'
f'I am sorry, You are banned to use Me. \nBan Reason: {ban["ban_reason"]}' )
) await ctx.stop_propagation()
await ctx.stop_propagation()
except:
await ctx.continue_propagation()
@app.on_message(filters.group & filters.incoming, group=-2) @app.on_message(filters.group & filters.incoming, group=-2)

View file

@ -28,7 +28,7 @@ async def draw_meme_text(image_path, text):
current_h, pad = 10, 5 current_h, pad = 10, 5
if upper_text: if upper_text:
for u_text in textwrap.wrap(upper_text, width=15): 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( draw.text(
xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)), 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 current_h += u_height + pad
if lower_text: if lower_text:
for l_text in textwrap.wrap(lower_text, width=15): 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( draw.text(
xy=( xy=(