diff --git a/cogs/fun.py b/cogs/fun.py index 8d11f21..5cd1966 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -5,6 +5,7 @@ This is a fun cog, it contains commands that are just for fun and don't have any import random import discohook import time +import aiohttp @discohook.command.slash('dice', description = 'Roll a dice!') async def dice_command(interaction): @@ -76,4 +77,12 @@ async def gtn_command(interaction, num: int): if int(num) == number: await interaction.response.send("Somehow, with a 1/9999 chance, you guessed the number!") else: - await interaction.response.send(f"You didn't guess the number. Try again! The number was {number} by the way.") \ No newline at end of file + await interaction.response.send(f"You didn't guess the number. Try again! The number was {number} by the way.") + +@discohook.command.slash('factoftheday', description="Fun facts!") +async def funfact_cmd(interaction): + async with aiohttp.ClientSession(base_url="https://uselessfacts.jsph.pl") as session: + async with session.get('/api/v2/facts/today', headers={"Accept": "text/plain"}) as resp: + text = await resp.text() + await interaction.response.send(text) + await session.close() \ No newline at end of file