diff --git a/techsupport_bot/commands/animal.py b/techsupport_bot/commands/animal.py index a2232cffd..ec4311bd7 100644 --- a/techsupport_bot/commands/animal.py +++ b/techsupport_bot/commands/animal.py @@ -17,6 +17,7 @@ async def setup(bot): await bot.add_cog(Cats(bot=bot)) await bot.add_cog(Dogs(bot=bot)) await bot.add_cog(Frogs(bot=bot)) + await bot.add_cog(Fox(bot=bot)) class Cats(cogs.BaseCog): @@ -71,3 +72,21 @@ async def frog(self, ctx: commands.Context): """ response = await self.bot.http_functions.http_call("get", self.API_BASE_URL) await ctx.send(response.url) + + +class Fox(cogs.BaseCog): + """The class for the fox api""" + + API_BASE_URL = "https://randomfox.ca/floof/" + + @auxiliary.with_typing + @commands.command(name="fox", brief="Gets a fox", description="Gets a fox") + async def fox(self, ctx: commands.Context): + """Prints a fox to discord + + Args: + ctx (commands.Context): The context in which the command was run + """ + response = await self.bot.http_functions.http_call("get", self.API_BASE_URL) + print(f"Response: {response}") + await ctx.send(response.image) diff --git a/techsupport_bot/core/http.py b/techsupport_bot/core/http.py index 0110fc46b..7050e52f3 100644 --- a/techsupport_bot/core/http.py +++ b/techsupport_bot/core/http.py @@ -59,6 +59,7 @@ def __init__(self, bot: bot.TechSupportBot) -> None: "api.thecatapi.com": (10, 60), "dog.ceo": (10, 60), "frogs.media": (3, 60), + "randomfox.ca": (4, 60), } # For the variable APIs, if they don't exist, don't rate limit them try: