Add basic blame command
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
56acadbc62
commit
eaa981f60d
20
src/memes.py
20
src/memes.py
@ -185,7 +185,7 @@ def getMemeUploader(file_name):
|
|||||||
uploader = tags.get("uploader")
|
uploader = tags.get("uploader")
|
||||||
if uploader != None:
|
if uploader != None:
|
||||||
return uploader
|
return uploader
|
||||||
return "Unkown"
|
return "No-one (probably tyler)"
|
||||||
|
|
||||||
# gets a random meme
|
# gets a random meme
|
||||||
# this will ensure that the meme is not in the last_memes list
|
# 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!"
|
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
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import requests
|
import requests
|
||||||
import os, random, sys
|
import os, random, sys
|
||||||
from memes import parseMeme, memeCount, memeDump, allMemes, uploadMeme
|
from memes import parseMeme, memeCount, memeDump, allMemes, uploadMeme, memeBlame
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
async def showHelp(very, useless, arguments):
|
async def showHelp(very, useless, arguments):
|
||||||
@ -31,13 +31,14 @@ calldict = {
|
|||||||
"!memecount" : memeCount,
|
"!memecount" : memeCount,
|
||||||
"!memedump" : memeDump,
|
"!memedump" : memeDump,
|
||||||
"!allmemes" : allMemes,
|
"!allmemes" : allMemes,
|
||||||
"!help" : showHelp,
|
|
||||||
"!up" : uploadMeme,
|
"!up" : uploadMeme,
|
||||||
"!upload" : uploadMeme,
|
"!upload" : uploadMeme,
|
||||||
"!uploadmeme": uploadMeme,
|
"!uploadmeme": uploadMeme,
|
||||||
#"!memeblame" : memeBlame
|
"!memeblame" : memeBlame,
|
||||||
|
"!blame" : memeBlame,
|
||||||
# plex
|
# plex
|
||||||
#"!plexleaderboard" : getTopUsers,
|
#"!plexleaderboard" : getTopUsers,
|
||||||
|
"!help" : showHelp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user