Add new meme cog

This commit is contained in:
CramMK
2020-04-24 16:35:44 +02:00
parent 061a35fd8e
commit 885967b96c
6 changed files with 50 additions and 20 deletions

View File

@@ -8,12 +8,38 @@ https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
import discord
from discord.ext import commands
class MemeError(Exception):
pass
# COG INIT
class Meme(commands.Cog):
def __init__(self, bot):
self.bot = bot
# COG BODY
@commands.command(name="meme")
async def meme(self, ctx, meme: str):
"""
Sends a spicy meme to the chat
"""
query = meme.capitalize()
if query == "list":
meme_list = ""
for key in loadconfig.__memes_list__.keys():
if not meme_list:
meme_list = meme_list + key
else:
meme_list = meme_list + ", " + key
await ctx.send(f"Currently listed memes: `{meme_list}`")
else:
try:
await ctx.send(loadconfig.__memes_list__[query]
except KeyError as e:
await ctx.send("Meme not found in database")
# COG ENDING
def setup(bot):

View File

@@ -2,7 +2,7 @@
Play Music
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
# https://gist.github.com/vbe0201/ade9b80f2d3b64643d854938d40a0a2d
https://gist.github.com/vbe0201/ade9b80f2d3b64643d854938d40a0a2d
"""
# IMPORTS - external

View File

@@ -65,14 +65,6 @@ class Utility(commands.Cog):
await ctx.send(response)
@commands.command(name="ollimeme")
async def olli_meme(self, ctx):
"""
Sends a high quality Olli Meme
"""
meme = random.choice(loadconfig.__olli_memes__)
await ctx.send(meme)
# COG ENDING
def setup(bot):

View File

@@ -9,22 +9,22 @@ pics_anime = [
"https://i.imgur.com/4xnJN9x.png",
]
girl_aqua = []
aqua = []
girl_noel = [
noel = [
"https://i.imgur.com/qSAjVSL.png",
]
girl_megumin = [
megumin = [
"https://i.imgur.com/mSBfcXA.jpg",
"https://i.imgur.com/Dqua2lX.jpg",
"https://i.imgur.com/1jzaE3y.png",
"https://i.imgur.com/KpGSYD2.png",
]
girl_akeno = []
akeno = []
girl_rem = [
rem = [
"https://i.imgur.com/8HNv6ow.jpg",
"https://i.imgur.com/GEhYHKi.png",
"https://i.imgur.com/5dtXgEc.jpg",
@@ -40,9 +40,9 @@ girl_rem = [
__media_anime__ = [gifs_anime, pics_anime]
__media_girl__ = {
"Aqua": girl_aqua,
"Noel": girl_noel,
"Megumin": girl_megumin,
"Akeno": girl_akeno,
"Rem": girl_rem
"Aqua": aqua,
"Noel": noel,
"Megumin": megumin,
"Akeno": akeno,
"Rem": rem
}

View File

@@ -1,5 +1,16 @@
# Meme list
__olli_memes__ = [
olli = [
"https://i.imgflip.com/3xpkiv.jpg",
"https://cdn.discordapp.com/attachments/541637988120133634/702992838702399518/grave.png",
]
cenk = [
"https://cdn.discordapp.com/attachments/541641216110886932/650706285431357440/geh.jpeg",
]
# Exports
__memes_list__ = {
"Olli": olli,
"Cenk": cenk
}

View File

@@ -29,5 +29,6 @@ try:
from config.status import __activity__
from config.media import __media_anime__, __media_girl__
from config.memes import __olli_memes__
from config.memes import __memes_list__
except ImportError as error:
print(f"Error while importing: {error}")