diff options
| author | 2020-03-29 09:03:27 +0300 | |
|---|---|---|
| committer | 2020-03-29 09:03:27 +0300 | |
| commit | 3e819043ce0538682b4512382974b641dc6872c0 (patch) | |
| tree | 1d7a527ff92d34ecab8cd6831fde2841d2a0d724 | |
| parent | (PEP Command): Moved icon URL to constant instead hard-coded string. (diff) | |
(PEP Command): Moved PEP 0 information to hard-coded strings from constants, moved PEP 0 sending to function.
| -rw-r--r-- | bot/cogs/utils.py | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index d15edd0a0..3cd259b35 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -40,14 +40,6 @@ If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! """ -PEP0_TITLE = "Index of Python Enhancement Proposals (PEPs)" -PEP0_INFO = { - "Status": "Active", - "Created": "13-Jul-2000", - "Type": "Informational" -} -PEP0_LINK = "https://www.python.org/dev/peps/" - ICON_URL = "https://www.python.org/static/opengraph-icon-200x200.png" @@ -72,16 +64,7 @@ class Utils(Cog): # Handle PEP 0 directly due it's static constant in PEPs GitHub repo in Python file, not .rst or .txt so it # can't be accessed like other PEPs. if pep_number == 0: - pep_embed = Embed( - title=f"**PEP 0 - {PEP0_TITLE}**", - description=f"[Link]({PEP0_LINK})" - ) - pep_embed.set_thumbnail(url=ICON_URL) - for field, value in PEP0_INFO.items(): - pep_embed.add_field(name=field, value=value) - - await ctx.send(embed=pep_embed) - return + return await self.send_pep_zero(ctx) possible_extensions = ['.txt', '.rst'] found_pep = False @@ -302,6 +285,19 @@ class Utils(Cog): for reaction in options: await message.add_reaction(reaction) + async def send_pep_zero(self, ctx: Context) -> None: + """Send information about PEP 0.""" + pep_embed = Embed( + title=f"**PEP 0 - Index of Python Enhancement Proposals (PEPs)**", + description=f"[Link](https://www.python.org/dev/peps/)" + ) + pep_embed.set_thumbnail(url=ICON_URL) + pep_embed.add_field(name="Status", value="Active") + pep_embed.add_field(name="Created", value="13-Jul-2000") + pep_embed.add_field(name="Type", value="Informational") + + await ctx.send(embed=pep_embed) + def setup(bot: Bot) -> None: """Load the Utils cog.""" |