From 0bc963c78abd9116f8bb0d9dc30e6602f333f76a Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Sat, 17 Dec 2022 22:43:14 -0500 Subject: [PATCH] Fix not using name --- src/memes.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/memes.py b/src/memes.py index e0413b0..c7fc258 100644 --- a/src/memes.py +++ b/src/memes.py @@ -282,9 +282,6 @@ async def memeDump(command, message, client): # get an uploaded meme and save it async def uploadMeme(command, message, client): global memes_to_md5 - #TODO check for memes sent using links - if len(message.attachments) <= 0: - return "You didn't attach anything! Please attach a file to upload" uploader_tags = Tags.new_object_tags() uploader_tags["uploader"] = message.author.name @@ -293,6 +290,12 @@ async def uploadMeme(command, message, client): client = getClient() file_names = [] + if len(message.attachments) <= 0: + return "You didn't attach anything! Please attach a file to upload" + + #TODO left off on adding logic to + + for file in message.attachments: # if we want to override the name uploaded_file_name = file.filename @@ -311,7 +314,7 @@ async def uploadMeme(command, message, client): await file.save("/tmp/" + file.filename) result = client.fput_object(bucket_name=S3_BUCKET, - object_name=file.filename, + object_name=uploaded_file_name, file_path="/tmp/" + file.filename, tags=uploader_tags, content_type=None)