Add new meme cog
This commit is contained in:
26
cogs/meme.py
26
cogs/meme.py
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user