move all the animals to slash commands

This commit is contained in:
Luke Robles 2022-10-13 10:20:56 -07:00
parent 04ae0b1578
commit bc12d4e185

View File

@ -7,64 +7,85 @@ class AnimalFunctions(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot: commands.Bot = bot self.bot: commands.Bot = bot
@commands.command(name="redpanda") @commands.slash_command(
guild_ids=None, name="redpanda", description="Posts a photo of a redpanda"
)
async def redpanda(self, ctx: commands.Context): async def redpanda(self, ctx: commands.Context):
await ctx.reply(animals.get_red_panda()) await ctx.respond(animals.get_red_panda())
@commands.command(name="panda") @commands.slash_command(
guild_ids=None, name="panda", description="Posts a photo of a panda"
)
async def panda(self, ctx: commands.Context): async def panda(self, ctx: commands.Context):
await ctx.reply(animals.get_panda()) await ctx.respond(animals.get_panda())
@commands.command(name="koala") @commands.slash_command(
guild_ids=None, name="koala", description="Posts a photo of a koala"
)
async def koala(self, ctx: commands.Context): async def koala(self, ctx: commands.Context):
await ctx.reply(animals.get_koala()) await ctx.respond(animals.get_koala())
@commands.command(name="racoon") @commands.slash_command(
guild_ids=None, name="racoon", description="Posts a photo of a racoon"
)
async def racoon(self, ctx: commands.Context): async def racoon(self, ctx: commands.Context):
await ctx.reply(animals.get_racoon()) await ctx.respond(animals.get_racoon())
@commands.command(name="fox") @commands.slash_command(
guild_ids=None, name="fox", description="Posts a photo of a fox"
)
async def fox(self, ctx: commands.Context): async def fox(self, ctx: commands.Context):
await ctx.reply(animals.get_fox()) await ctx.respond(animals.get_fox())
@commands.command(name="cat") @commands.slash_command(
guild_ids=None, name="cat", description="Posts a photo of a cat"
)
async def cat(self, ctx: commands.Context): async def cat(self, ctx: commands.Context):
await ctx.reply(animals.get_cat()) await ctx.respond(animals.get_cat())
@commands.command(name="kangaroo") @commands.slash_command(
guild_ids=None, name="kangaroo", description="Posts a photo of a kangaroo"
)
async def kangaroo(self, ctx: commands.Context): async def kangaroo(self, ctx: commands.Context):
await ctx.reply(animals.get_kangaroo()) await ctx.respond(animals.get_kangaroo())
@commands.command(name="dog") @commands.slash_command(
guild_ids=None, name="dog", description="Posts a photo of a dog"
)
async def dog(self, ctx: commands.Context): async def dog(self, ctx: commands.Context):
await ctx.reply(animals.get_dog()) await ctx.respond(animals.get_dog())
@commands.command( @commands.slash_command(
name="sheeb", guild_ids=None, name="sheeb", description="Posts a photo of a sheeb"
aliases=["shiba", "shib", "shoob", "sheeber", "shoober", "shobe", "shibe"],
) )
async def sheeb(self, ctx: commands.Context): async def sheeb(self, ctx: commands.Context):
await ctx.reply(animals.random_sheeb()) await ctx.respond(animals.random_sheeb())
@commands.command(name="birb") @commands.slash_command(
guild_ids=None, name="birb", description="Posts a photo of a birb"
)
async def birb(self, ctx: commands.Context): async def birb(self, ctx: commands.Context):
await ctx.reply(animals.get_birb()) await ctx.respond(animals.get_birb())
@commands.command(name="cowboy") @commands.slash_command(
guild_ids=None, name="cowboy", description="Posts a photo of a bad dog"
)
async def cowboy(self, ctx: commands.Context): async def cowboy(self, ctx: commands.Context):
await ctx.reply(animals.cowboy()) await ctx.respond(animals.cowboy())
@commands.command(name="dale") @commands.slash_command(
guild_ids=None, name="dale", description="Posts a photo of the goodest boy"
)
async def dale(self, ctx: commands.Context): async def dale(self, ctx: commands.Context):
# If the file picked is too large, try again # If the file picked is too large, try again
@ -72,16 +93,16 @@ class AnimalFunctions(commands.Cog):
while not dale_pic: while not dale_pic:
try: try:
dale_pic = animals.dale() dale_pic = animals.dale()
await ctx.reply(file=discord.File(dale_pic)) await ctx.respond(file=discord.File(dale_pic))
except Exception: except Exception:
print("File too large, trying again") print("File too large, trying again")
dale_pic = None dale_pic = None
@commands.command(name="rat") @commands.slash_command(
guild_ids=None, name="rat", description="Posts a photo of a rat"
)
async def rat(self, ctx: commands.Context): async def rat(self, ctx: commands.Context):
import animals await ctx.respond(animals.get_rat())
await ctx.reply(animals.get_rat())
def setup(bot): def setup(bot):