Add meme blame command #15

Merged
tyler merged 4 commits from meme-blame into main 2022-12-24 19:48:43 +00:00
Showing only changes of commit f51e940cd4 - Show all commits

View File

@ -348,10 +348,16 @@ async def uploadMeme(command, message, discordClient):
return "Thanks got your memes!" return "Thanks got your memes!"
async def memeBlame(command, message, discordClient): async def memeBlame(command, message, discordClient):
query_string = ""
if len(command) <= 1: if len(command) <= 1:
return "I need a file name or query!" if message.reference is not None: # this is a reply blame
m = await message.channel.fetch_message(message.reference.message_id)
if m.attachments is not None and len(m.attachments) > 0:
query_string = m.attachments[0].filename
else: return "No file attached to replied message!"
else: return "I need a file name or query!"
else: query_string = ' '.join(command[1:]) #get QUERY_STRING
query_string = ' '.join(command[1:]) #get QUERY_STRING
return_string = "" return_string = ""
all_memes = getCurrentMemeList() all_memes = getCurrentMemeList()
@ -365,5 +371,3 @@ async def memeBlame(command, message, discordClient):
return_string += "uploaded by " + author return_string += "uploaded by " + author
return return_string return return_string