dragon-bot/app/cogs/animal_functions.py
2022-10-13 10:20:56 -07:00

110 lines
3.2 KiB
Python

from discord.ext import commands
import discord
import animals
class AnimalFunctions(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
@commands.slash_command(
guild_ids=None, name="redpanda", description="Posts a photo of a redpanda"
)
async def redpanda(self, ctx: commands.Context):
await ctx.respond(animals.get_red_panda())
@commands.slash_command(
guild_ids=None, name="panda", description="Posts a photo of a panda"
)
async def panda(self, ctx: commands.Context):
await ctx.respond(animals.get_panda())
@commands.slash_command(
guild_ids=None, name="koala", description="Posts a photo of a koala"
)
async def koala(self, ctx: commands.Context):
await ctx.respond(animals.get_koala())
@commands.slash_command(
guild_ids=None, name="racoon", description="Posts a photo of a racoon"
)
async def racoon(self, ctx: commands.Context):
await ctx.respond(animals.get_racoon())
@commands.slash_command(
guild_ids=None, name="fox", description="Posts a photo of a fox"
)
async def fox(self, ctx: commands.Context):
await ctx.respond(animals.get_fox())
@commands.slash_command(
guild_ids=None, name="cat", description="Posts a photo of a cat"
)
async def cat(self, ctx: commands.Context):
await ctx.respond(animals.get_cat())
@commands.slash_command(
guild_ids=None, name="kangaroo", description="Posts a photo of a kangaroo"
)
async def kangaroo(self, ctx: commands.Context):
await ctx.respond(animals.get_kangaroo())
@commands.slash_command(
guild_ids=None, name="dog", description="Posts a photo of a dog"
)
async def dog(self, ctx: commands.Context):
await ctx.respond(animals.get_dog())
@commands.slash_command(
guild_ids=None, name="sheeb", description="Posts a photo of a sheeb"
)
async def sheeb(self, ctx: commands.Context):
await ctx.respond(animals.random_sheeb())
@commands.slash_command(
guild_ids=None, name="birb", description="Posts a photo of a birb"
)
async def birb(self, ctx: commands.Context):
await ctx.respond(animals.get_birb())
@commands.slash_command(
guild_ids=None, name="cowboy", description="Posts a photo of a bad dog"
)
async def cowboy(self, ctx: commands.Context):
await ctx.respond(animals.cowboy())
@commands.slash_command(
guild_ids=None, name="dale", description="Posts a photo of the goodest boy"
)
async def dale(self, ctx: commands.Context):
# If the file picked is too large, try again
dale_pic = None
while not dale_pic:
try:
dale_pic = animals.dale()
await ctx.respond(file=discord.File(dale_pic))
except Exception:
print("File too large, trying again")
dale_pic = None
@commands.slash_command(
guild_ids=None, name="rat", description="Posts a photo of a rat"
)
async def rat(self, ctx: commands.Context):
await ctx.respond(animals.get_rat())
def setup(bot):
bot.add_cog(AnimalFunctions(bot))