Add reply upload functionality
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Tyler Perkins 2022-12-17 23:14:11 -05:00
parent 693999ae21
commit 5c05a8a262
2 changed files with 12 additions and 2 deletions

View File

@ -210,6 +210,7 @@ def nameBuilder(command):
return uploaded_file_name return uploaded_file_name
############################################################################### ###############################################################################
# Calldict methods # Calldict methods
@ -280,7 +281,7 @@ async def memeDump(command, message, client):
return "Enjoy your memes :)" return "Enjoy your memes :)"
# 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, discordClient):
global memes_to_md5 global memes_to_md5
uploader_tags = Tags.new_object_tags() uploader_tags = Tags.new_object_tags()
@ -291,7 +292,12 @@ async def uploadMeme(command, message, client):
file_names = [] file_names = []
if len(message.attachments) <= 0: if len(message.attachments) <= 0:
return "You didn't attach anything! Please attach a file to upload" if message.reference is not None: # this is a reply upload
m = await message.channel.fetch_message(message.reference.message_id)
result = await uploadMeme(command, m, client)
return result
else:
return "You didn't attach anything! Please attach a file to upload"
#TODO left off on adding logic to #TODO left off on adding logic to

View File

@ -16,6 +16,10 @@ async def showHelp(very, useless, arguments):
str += " Get all memes that are like the given query\n" str += " Get all memes that are like the given query\n"
str += "!help\n" str += "!help\n"
str += " Print this message\n" str += " Print this message\n"
str += "!up [NAME]\n"
str += " Upload a meme. If NAME is provided it will be named as such.\n"
str += " You need to either attach the meme with the message, or reply to a\n"
str += " message with the meme you want to upload\n"
str += "```" str += "```"
return str return str