This commit is contained in:
yasirarism 2023-07-03 21:28:05 +07:00 committed by GitHub
parent 49ae5798ed
commit 220a7ed493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View file

@ -496,14 +496,8 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
@app.on_message(filters.command(["update"], COMMAND_HANDLER) & filters.user(SUDO))
@use_chat_lang()
async def update_restart(self: Client, ctx: Message, strings) -> "Message":
try:
out = (await shell_exec("git pull"))[0]
if "Already up to date." in str(out):
return await ctx.reply_msg(strings("already_up"))
await ctx.reply_msg(f"<code>{out}</code>")
except Exception as e:
return await ctx.reply_msg(str(e))
msg = await ctx.reply_msg(strings("up_and_rest"))
await shell_exec("python3 update.py")
with open("restart.pickle", "wb") as status:
pickle.dump([ctx.chat.id, msg.id], status)
os.execvp(sys.executable, [sys.executable, "-m", "misskaty"])

View file

@ -29,7 +29,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.textlength(text=u_text, font=m_font).split(".")
u_width, u_height = str(draw.textlength(text=u_text, font=m_font)).split(".")
draw.text(
xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)),
text=u_text,
@ -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.textlength(text=l_text, font=m_font).split(".")
u_width, u_height = str(draw.textlength(text=l_text, font=m_font)).split(".")
draw.text(
xy=(