aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/utils.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index 22e0cfbe7..b101b8816 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -30,11 +30,16 @@ class Utils:
Fetches information about a PEP and sends it to the channel.
"""
+ if pep_number.isdigit():
+ pep_number = int(pep_number)
+ else:
+ return await ctx.invoke(self.bot.get_command("help"), "pep")
+
# Newer PEPs are written in RST instead of txt
- if int(pep_number) > 542:
- pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.rst"
+ if pep_number > 542:
+ pep_url = f"{self.base_github_pep_url}{pep_number:04}.rst"
else:
- pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.txt"
+ pep_url = f"{self.base_github_pep_url}{pep_number:04}.txt"
# Attempt to fetch the PEP
log.trace(f"Requesting PEP {pep_number} with {pep_url}")
@@ -51,7 +56,7 @@ class Utils:
# Assemble the embed
pep_embed = Embed(
title=f"**PEP {pep_number} - {pep_header['Title']}**",
- description=f"[Link]({self.base_pep_url}{pep_number.zfill(4)})",
+ description=f"[Link]({self.base_pep_url}{pep_number:04})",
)
pep_embed.set_thumbnail(url="https://www.python.org/static/opengraph-icon-200x200.png")