aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2020-03-29 11:56:36 -0400
committerGravatar GitHub <[email protected]>2020-03-29 11:56:36 -0400
commitca7147e013ecac474e0c396c516091db4ad2521a (patch)
tree678e3335d2b19cb93a329c3c5b1654ac2ceb9f76
parent(Webhook Detection): Fixed grouping of regex, alert message content, docstrin... (diff)
parentMerge pull request #848 from ks129/pep0 (diff)
Merge branch 'master' into webhook-match
-rw-r--r--bot/cogs/utils.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index 024141d62..f0b1172e3 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -40,6 +40,8 @@ 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!
"""
+ICON_URL = "https://www.python.org/static/opengraph-icon-200x200.png"
+
class Utils(Cog):
"""A selection of utilities which don't have a clear category."""
@@ -59,6 +61,10 @@ class Utils(Cog):
await ctx.invoke(self.bot.get_command("help"), "pep")
return
+ # Handle PEP 0 directly because it's not in .rst or .txt so it can't be accessed like other PEPs.
+ if pep_number == 0:
+ return await self.send_pep_zero(ctx)
+
possible_extensions = ['.txt', '.rst']
found_pep = False
for extension in possible_extensions:
@@ -82,7 +88,7 @@ class Utils(Cog):
description=f"[Link]({self.base_pep_url}{pep_number:04})",
)
- pep_embed.set_thumbnail(url="https://www.python.org/static/opengraph-icon-200x200.png")
+ pep_embed.set_thumbnail(url=ICON_URL)
# Add the interesting information
fields_to_check = ("Status", "Python-Version", "Created", "Type")
@@ -278,6 +284,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."""