mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-07 04:14:51 +00:00
Add doc in toimage
This commit is contained in:
parent
867e4f761f
commit
850d06f1b2
1 changed files with 7 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ import os
|
||||||
import time
|
import time
|
||||||
import asyncio
|
import asyncio
|
||||||
import traceback
|
import traceback
|
||||||
|
from PIL import Image
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
@ -237,12 +238,13 @@ async def topho(client, message):
|
||||||
return await message.reply_text("Reply ke sticker untuk mengubah ke foto")
|
return await message.reply_text("Reply ke sticker untuk mengubah ke foto")
|
||||||
if message.reply_to_message.sticker.is_animated:
|
if message.reply_to_message.sticker.is_animated:
|
||||||
return await message.reply_text("Ini sticker animasi, command ini hanya untuk sticker biasa.")
|
return await message.reply_text("Ini sticker animasi, command ini hanya untuk sticker biasa.")
|
||||||
photo = await client.download_media(
|
photo = await message.reply_to_message.download()
|
||||||
message.reply_to_message.sticker.file_id,
|
im = Image.open(photo).convert("RGB")
|
||||||
f"tostick_{message.from_user.id}.jpg",
|
filename = f"toimg_{message.from_user.id}.png"
|
||||||
)
|
im.save(filename, "png")
|
||||||
await asyncio.gather(*[message.reply_document(photo), message.reply_photo(photo, caption=f"Sticker -> Image\n@{client.me.username}")])
|
await asyncio.gather(*[message.reply_document(filename), message.reply_photo(filename, caption=f"Sticker -> Image\n@{client.me.username}")])
|
||||||
os.remove(photo)
|
os.remove(photo)
|
||||||
|
os.remove(filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.reply_text(str(e))
|
await message.reply_text(str(e))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue