Add other upload improvements #7
11
src/memes.py
11
src/memes.py
@ -282,9 +282,6 @@ async def memeDump(command, message, client):
|
|||||||
# get an uploaded meme and save it
|
# get an uploaded meme and save it
|
||||||
async def uploadMeme(command, message, client):
|
async def uploadMeme(command, message, client):
|
||||||
global memes_to_md5
|
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 = Tags.new_object_tags()
|
||||||
uploader_tags["uploader"] = message.author.name
|
uploader_tags["uploader"] = message.author.name
|
||||||
@ -293,6 +290,12 @@ async def uploadMeme(command, message, client):
|
|||||||
client = getClient()
|
client = getClient()
|
||||||
file_names = []
|
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:
|
for file in message.attachments:
|
||||||
# if we want to override the name
|
# if we want to override the name
|
||||||
uploaded_file_name = file.filename
|
uploaded_file_name = file.filename
|
||||||
@ -311,7 +314,7 @@ async def uploadMeme(command, message, client):
|
|||||||
await file.save("/tmp/" + file.filename)
|
await file.save("/tmp/" + file.filename)
|
||||||
|
|
||||||
result = client.fput_object(bucket_name=S3_BUCKET,
|
result = client.fput_object(bucket_name=S3_BUCKET,
|
||||||
object_name=file.filename,
|
object_name=uploaded_file_name,
|
||||||
file_path="/tmp/" + file.filename,
|
file_path="/tmp/" + file.filename,
|
||||||
tags=uploader_tags,
|
tags=uploader_tags,
|
||||||
content_type=None)
|
content_type=None)
|
||||||
|
Loading…
Reference in New Issue
Block a user