Add meme blame command #15
20
src/memes.py
20
src/memes.py
@ -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
|
||||
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user