Add other upload improvements #7

Merged
tyler merged 4 commits from upload-improvements into main 2022-12-18 04:15:16 +00:00
Showing only changes of commit 0bc963c78a - Show all commits

View File

@ -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)