Add memes

This commit is contained in:
CramMK
2020-04-24 16:58:49 +02:00
parent 885967b96c
commit f20fec4431
4 changed files with 19 additions and 5 deletions

View File

@@ -4,9 +4,13 @@ Send spicy memes to chat
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
""" """
# IMPORTS # IMPORTS - external
import discord import discord
from discord.ext import commands from discord.ext import commands
import random
# IMPORTS - internal
import loadconfig
class MemeError(Exception): class MemeError(Exception):
pass pass
@@ -24,7 +28,7 @@ class Meme(commands.Cog):
""" """
query = meme.capitalize() query = meme.capitalize()
if query == "list": if query == "List":
meme_list = "" meme_list = ""
for key in loadconfig.__memes_list__.keys(): for key in loadconfig.__memes_list__.keys():
if not meme_list: if not meme_list:
@@ -35,7 +39,8 @@ class Meme(commands.Cog):
await ctx.send(f"Currently listed memes: `{meme_list}`") await ctx.send(f"Currently listed memes: `{meme_list}`")
else: else:
try: try:
await ctx.send(loadconfig.__memes_list__[query] meme = random.choice(loadconfig.__memes_list__[query])
await ctx.send(meme)
except KeyError as e: except KeyError as e:
await ctx.send("Meme not found in database") await ctx.send("Meme not found in database")

View File

@@ -144,6 +144,7 @@ class Song:
description=description, description=description,
colour=discord.Colour.blue() colour=discord.Colour.blue()
)) ))
embed.add_field(name='Uploader', value='[{0.source.uploader}]({0.source.uploader_url})'.format(self))
embed.add_field(name="Duration", value=self.source.duration) embed.add_field(name="Duration", value=self.source.duration)
embed.add_field(name="Requested by", value=self.requester.mention) embed.add_field(name="Requested by", value=self.requester.mention)
embed.add_field(name='URL', value='[Click]({0.source.url})'.format(self)) embed.add_field(name='URL', value='[Click]({0.source.url})'.format(self))

View File

@@ -6,11 +6,20 @@ olli = [
cenk = [ cenk = [
"https://cdn.discordapp.com/attachments/541641216110886932/650706285431357440/geh.jpeg", "https://cdn.discordapp.com/attachments/541641216110886932/650706285431357440/geh.jpeg",
"https://cdn.discordapp.com/attachments/541641216110886932/650705814419537928/versteck.jpeg",
"https://cdn.discordapp.com/attachments/541641216110886932/650705816491393025/nimm.jpeg",
"https://cdn.discordapp.com/attachments/541641216110886932/650705817770917895/behalt.jpeg",
"https://cdn.discordapp.com/attachments/541641216110886932/650705818559447051/gib.jpeg"
]
marc = [
"https://cdn.discordapp.com/attachments/541641216110886932/626153093226299411/MaddlsticksTransparent.png"
] ]
# Exports # Exports
__memes_list__ = { __memes_list__ = {
"Olli": olli, "Olli": olli,
"Cenk": cenk "Cenk": cenk,
"Marc": marc
} }

View File

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