aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/pythonfacts.py
blob: b1c28d4b6b7e4537abd6b6a901915cdb5a025dd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import random

import discord
from discord.ext import commands


class PythonFacts(commands.Cog):
    """Gives a random fun fact about Python."""

    def __init__(self, bot: commands.Bot) -> None:
        self.bot = bot

    @commands.command(name='pythonfact', aliases=['pyfact'])
    async def get_python_fact(self, ctx: commands.Context) -> None:
        """Gives a Random fun fact about Python."""
        with open('bot/resources/evergreen/python_facts.txt') as file:
            await ctx.send(embed=discord.Embed(title='Python Facts', description=f'**{random.choice(list(file))}**'))


def setup(bot: commands.Bot) -> None:
    """Adding the cog to the bot."""
    bot.add_cog(PythonFacts(bot))