Update sticker naming

This commit is contained in:
iwumingz 2022-04-09 21:00:23 +08:00
parent 768f8d5acc
commit a4c1c5c571

View File

@ -1,5 +1,4 @@
import asyncio import asyncio
from datetime import datetime
import os import os
from core import command from core import command
@ -43,13 +42,10 @@ async def download(_: Client, msg: Message):
replied_msg = msg.reply_to_message replied_msg = msg.reply_to_message
if not replied_msg: if not replied_msg:
return await show_cmd_tip(msg, cmd) return await show_cmd_tip(msg, cmd)
if replied_msg.sticker:
creation = datetime.strftime(datetime.now(), '%Y_%m_%d_%H_%M_%S')
file_name = f"{DOWNLOAD_PATH}sticker_{creation}.webp"
else:
file_name = DOWNLOAD_PATH if not where else where
try: try:
res = await replied_msg.download(file_name=file_name) res = await replied_msg.download(
file_name=DOWNLOAD_PATH if not where else where)
except ValueError: except ValueError:
return await show_cmd_tip(msg, cmd) return await show_cmd_tip(msg, cmd)
except Exception as e: except Exception as e: