Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions techsupport_bot/commands/animal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions techsupport_bot/core/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down