diff options
author | 2021-02-16 09:10:57 -0800 | |
---|---|---|
committer | 2021-02-16 09:10:57 -0800 | |
commit | 7ba7149c688ba35d60934fdc68b92b82862065c7 (patch) | |
tree | af146ff8b1c09951df377b181a21b3d49d773f91 /bot/exts/evergreen/pythonfacts.py | |
parent | Merge pull request #589 from python-discord/Reset-valentine-command-cooldown-... (diff) |
Add .pyfacts command
Diffstat (limited to 'bot/exts/evergreen/pythonfacts.py')
-rw-r--r-- | bot/exts/evergreen/pythonfacts.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py new file mode 100644 index 00000000..ba792561 --- /dev/null +++ b/bot/exts/evergreen/pythonfacts.py @@ -0,0 +1,23 @@ +import random + +import discord +from discord.ext import commands +from discord.ext.commands.bot import Bot + + +class PythonFacts(commands.Cog): + """Gives a random fun fact about Python.""" + + def __init__(self, bot: 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)) |