Add basic blame command
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tyler Perkins 2022-12-24 14:30:31 -05:00
parent 56acadbc62
commit eaa981f60d
2 changed files with 23 additions and 4 deletions

View File

@ -185,7 +185,7 @@ def getMemeUploader(file_name):
uploader = tags.get("uploader")
if uploader != None:
return uploader
return "Unkown"
return "No-one (probably tyler)"
# gets a random meme
# this will ensure that the meme is not in the last_memes list
@ -347,5 +347,23 @@ async def uploadMeme(command, message, discordClient):
return "Thanks got your memes!"
async def memeBlame(command, message, discordClient):
if len(command) <= 1:
return "I need a file name or query!"
query_string = ' '.join(command[1:]) #get QUERY_STRING
return_string = ""
all_memes = getCurrentMemeList()
if query_string in all_memes:
author = getMemeUploader(query_string)
return_string = author + " uploaded " + query_string
else:
close_meme, total_close_memes = getCloseMemeToQuery(query_string)
author = getMemeUploader(close_meme)
return_string = "I think you meant \"" + close_meme + "\", which was "
return_string += "uploaded by " + author
return return_string

View File

@ -1,7 +1,7 @@
#!/usr/bin/python3
import requests
import os, random, sys
from memes import parseMeme, memeCount, memeDump, allMemes, uploadMeme
from memes import parseMeme, memeCount, memeDump, allMemes, uploadMeme, memeBlame
import discord
async def showHelp(very, useless, arguments):
@ -31,13 +31,14 @@ calldict = {
"!memecount" : memeCount,
"!memedump" : memeDump,
"!allmemes" : allMemes,
"!help" : showHelp,
"!up" : uploadMeme,
"!upload" : uploadMeme,
"!uploadmeme": uploadMeme,
#"!memeblame" : memeBlame
"!memeblame" : memeBlame,
"!blame" : memeBlame,
# plex
#"!plexleaderboard" : getTopUsers,
"!help" : showHelp,
}