Fix error in saving original zip files

This commit is contained in:
Dusty.P 2018-05-09 21:22:01 -08:00
parent 9cebee3558
commit bb6e7aef41

View File

@ -21,6 +21,8 @@ class Uploader:
attachment = ctx.message.attachments[0] attachment = ctx.message.attachments[0]
if attachment.filename.endswith('.zip'): if attachment.filename.endswith('.zip'):
async with ctx.typing(): async with ctx.typing():
if not os.path.isdir(f'{storage_dir}/orig/'):
os.mkdir(f'{storage_dir}/orig/')
with open(f'{storage_dir}/orig/{attachment.filename}', 'wb') as file: with open(f'{storage_dir}/orig/{attachment.filename}', 'wb') as file:
attachment.save(file) attachment.save(file)
with BytesIO() as file: with BytesIO() as file: