️ 修复无法偷取动图的问题

This commit is contained in:
xtaodada 2020-02-22 21:14:25 +08:00
parent 0788d36a2b
commit c5b9689218
No known key found for this signature in database
GPG Key ID: 39EFACA711DF5D8C

View File

@ -36,7 +36,9 @@ async def sticker(context):
custom_emoji = True custom_emoji = True
elif (DocumentAttributeFilename(file_name='AnimatedSticker.tgs') in elif (DocumentAttributeFilename(file_name='AnimatedSticker.tgs') in
message.media.document.attributes): message.media.document.attributes):
emoji = message.media.document.attributes[0].alt photo = BytesIO()
await bot.download_file(message.media.document, "AnimatedSticker.tgs")
emoji = message.media.document.attributes[1].alt
custom_emoji = True custom_emoji = True
animated = True animated = True
photo = 1 photo = 1
@ -152,8 +154,8 @@ async def add_sticker(conversation, command, pack_title, pack_name, animated, me
async def upload_sticker(animated, message, context, file, conversation): async def upload_sticker(animated, message, context, file, conversation):
if animated: if animated:
await bot.forward_messages( await context.edit("上传动图中 . . .")
'Stickers', [message.id], context.chat_id) await conversation.send_file("AnimatedSticker.tgs", force_document=True)
else: else:
file.seek(0) file.seek(0)
await context.edit("上传图片中 . . .") await context.edit("上传图片中 . . .")