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

This commit is contained in:
Tyler Perkins 2022-12-24 14:42:03 -05:00
parent eaa981f60d
commit f51e940cd4

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