Add media stuff

This commit is contained in:
CramMK
2020-02-12 13:36:48 +00:00
parent 4581f24da9
commit 1251b915d9
5 changed files with 70 additions and 17 deletions

View File

@@ -5,9 +5,13 @@ Some anime-related commands:
https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html
"""
# IMPORTS
# IMPORTS - external
import discord
from discord.ext import commands
import random
# IMPORTS - internal
import loadconfig
# COG INIT
class Anime(commands.Cog):
@@ -15,6 +19,32 @@ class Anime(commands.Cog):
self.bot = bot
# COG BODY
@commands.command(name="animemedia")
async def animemedia(self, ctx):
"""
Sends a random anime gif or pic
"""
# Choose either a gif or a pic -> config/media.py
media_type = random.choice(loadconfig.__anime_media__)
media = random.choice(media)
await ctx.send(media)
@commands.command(name="waifumedia")
async def waifumedia(self, ctx, waifu: str):
"""
Sends a random pic of a waifu (list in config/media.py)
"""
# Dictionary
waifus = loadconfig.__waifu_media__
try:
media = random.choice(waifus.get(waifu))
await ctx.send(media)
except KeyError as error:
text = (
f"Waifu `{waifu}` not found in database!\n"
"It probably sucks...")
await ctx.send(text)
# COG ENDING
def setup(bot):

View File

@@ -36,8 +36,7 @@ class General(commands.Cog):
footer_text = (
"This Bot is an OpenSource project by Marc and can be found "
"on github.com/CramMK/aquabot"
)
"on github.com/CramMK/aquabot")
embed.set_footer(text=footer_text, icon_url=loadconfig.__avatar__)
await ctx.send(embed=embed)