diff options
| author | 2021-05-16 15:50:07 -0400 | |
|---|---|---|
| committer | 2021-05-16 15:50:07 -0400 | |
| commit | 07b5f296bed099d4cde849cfeba3320e3f4aa808 (patch) | |
| tree | 87b8efa0a3d11d38eb0f77c75e4a42d5033584b9 /bot/exts/evergreen/pythonfacts.py | |
| parent | delete trailing whitespace after docstring (diff) | |
| parent | Merge pull request #738 from python-discord/vcokltfre/feat/bookmark-reply (diff) | |
Merge branch 'main' into main
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/evergreen/pythonfacts.py | 29 | 
1 files changed, 16 insertions, 13 deletions
| diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py index 457c2fd3..80a8da5d 100644 --- a/bot/exts/evergreen/pythonfacts.py +++ b/bot/exts/evergreen/pythonfacts.py @@ -3,31 +3,34 @@ import itertools  import discord  from discord.ext import commands +from bot.bot import Bot  from bot.constants import Colours -with open('bot/resources/evergreen/python_facts.txt') as file: +with open("bot/resources/evergreen/python_facts.txt") as file:      FACTS = itertools.cycle(list(file))  COLORS = itertools.cycle([Colours.python_blue, Colours.python_yellow]) +PYFACTS_DISCUSSION = "https://github.com/python-discord/meta/discussions/93"  class PythonFacts(commands.Cog):      """Sends a random fun fact about Python.""" -    def __init__(self, bot: commands.Bot) -> None: -        self.bot = bot - -    @commands.command(name='pythonfact', aliases=['pyfact']) +    @commands.command(name="pythonfact", aliases=("pyfact",))      async def get_python_fact(self, ctx: commands.Context) -> None:          """Sends a Random fun fact about Python.""" -        embed = discord.Embed(title='Python Facts', -                                    description=next(FACTS), -                                    colour=next(COLORS)) -        embed.add_field(name='Suggestions', -                        value="Suggest more facts [here!](https://github.com/python-discord/meta/discussions/93)") +        embed = discord.Embed( +            title="Python Facts", +            description=next(FACTS), +            colour=next(COLORS) +        ) +        embed.add_field( +            name="Suggestions", +            value=f"Suggest more facts [here!]({PYFACTS_DISCUSSION})" +        )          await ctx.send(embed=embed) -def setup(bot: commands.Bot) -> None: -    """Load PythonFacts Cog.""" -    bot.add_cog(PythonFacts(bot)) +def setup(bot: Bot) -> None: +    """Load the PythonFacts Cog.""" +    bot.add_cog(PythonFacts()) | 
