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

import discord
from discord.ext import commands


with open('bot/resources/evergreen/python_facts.txt') as file:
    FACTS = list(file)


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."""
        await ctx.send(embed=discord.Embed(title='Python Facts', description=random.choice(FACTS)))


def setup(bot: commands.Bot) -> None:
    """Load PythonFacts Cog."""
    bot.add_cog(PythonFacts(bot))