Skip to content

Commit

Permalink
[MissKaty] Merge toimage command with getsticker
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir Aris M <[email protected]>
  • Loading branch information
yasirarism committed Dec 27, 2023
1 parent 57bb5ab commit 1acf3f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
28 changes: 0 additions & 28 deletions misskaty/plugins/misc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,34 +422,6 @@ async def tostick(client, message):
await message.reply_text(str(e))


@app.on_message(filters.command(["toimage"], COMMAND_HANDLER))
@capture_err
async def topho(client, message):
try:
if not message.reply_to_message or not message.reply_to_message.sticker:
return await message.reply_text("Reply ke sticker untuk mengubah ke foto")
if message.reply_to_message.sticker.is_animated:
return await message.reply_text(
"Ini sticker animasi, command ini hanya untuk sticker biasa."
)
photo = await message.reply_to_message.download()
im = Image.open(photo).convert("RGB")
filename = f"toimg_{message.from_user.id}.png"
im.save(filename, "png")
await asyncio.gather(
*[
message.reply_document(filename),
message.reply_photo(
filename, caption=f"Sticker -> Image\n@{client.me.username}"
),
]
)
os.remove(photo)
os.remove(filename)
except Exception as e:
await message.reply_text(str(e))


@app.on_message(filters.command(["id"], COMMAND_HANDLER))
async def showid(_, message):
chat_type = message.chat.type.value
Expand Down
2 changes: 1 addition & 1 deletion misskaty/plugins/stickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_emoji_regex():
SUPPORTED_TYPES = ["jpeg", "png", "webp"]


@app.on_cmd("getsticker")
@app.on_cmd(filters.command(["getsticker", "toimage"], COMMAND_HANDLER))
@use_chat_lang()
async def getsticker_(self: Client, ctx: Message, strings):
if not ctx.reply_to_message:
Expand Down

0 comments on commit 1acf3f2

Please sign in to comment.