mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
export: set the proper file time for each emote
This commit is contained in:
parent
e32890fb60
commit
89ec168e87
1 changed files with 8 additions and 1 deletions
|
@ -214,8 +214,15 @@ class Emotes(commands.Cog):
|
|||
async with context.typing():
|
||||
with zipfile.ZipFile(out, 'w', compression=zipfile.ZIP_STORED) as zip:
|
||||
async def store(emote):
|
||||
# place some level of trust on discord's CDN to actually give us images
|
||||
data = await self.fetch_safe(str(emote.url), validate_headers=False)
|
||||
zip.writestr(f'{emote.name}.{"gif" if emote.animated else "png"}', data)
|
||||
if type(data) is str:
|
||||
await context.send(f'{emote}: {data}')
|
||||
return
|
||||
zinfo = zipfile.ZipInfo(
|
||||
f'{emote.name}.{"gif" if emote.animated else "png"}',
|
||||
date_time=emote.created_at.timetuple()[:6])
|
||||
zip.writestr(zinfo, data)
|
||||
await utils.gather_or_cancel(*(store(emote) for emote in emotes))
|
||||
|
||||
out.seek(0)
|
||||
|
|
Loading…
Reference in a new issue