🎖 自动删除下载的动图源文件

This commit is contained in:
xtaodada 2020-02-24 09:29:40 +08:00
parent 81f73c0f9b
commit 94e1c9bdc8
No known key found for this signature in database
GPG Key ID: 39EFACA711DF5D8C

View File

@ -1,5 +1,6 @@
""" PagerMaid module to handle sticker collection. """ """ PagerMaid module to handle sticker collection. """
from os import remove
from urllib import request from urllib import request
from io import BytesIO from io import BytesIO
from telethon.tl.types import DocumentAttributeFilename, MessageMediaPhoto from telethon.tl.types import DocumentAttributeFilename, MessageMediaPhoto
@ -156,6 +157,7 @@ async def upload_sticker(animated, message, context, file, conversation):
if animated: if animated:
await context.edit("上传动图中 . . .") await context.edit("上传动图中 . . .")
await conversation.send_file("AnimatedSticker.tgs", force_document=True) await conversation.send_file("AnimatedSticker.tgs", force_document=True)
remove("AnimatedSticker.tgs")
else: else:
file.seek(0) file.seek(0)
await context.edit("上传图片中 . . .") await context.edit("上传图片中 . . .")