aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joseph Banks <[email protected]>2018-07-07 18:23:47 +0000
committerGravatar Joseph Banks <[email protected]>2018-07-07 18:23:47 +0000
commit44551982f646b813e3a9267f783479fe300271c2 (patch)
tree4c128b1963590970ffb7910ea6572f10242af683
parentFix incorrect log line (diff)
parentchange the pep fetch URL based on the PEP number because newer peps are writt... (diff)
Merge branch 'fix_pep_command' into 'master'
Fix a small bug with bot.pep() See merge request python-discord/projects/bot!10
-rw-r--r--bot/cogs/utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py
index ee1f0a199..7b11f521c 100644
--- a/bot/cogs/utils.py
+++ b/bot/cogs/utils.py
@@ -30,8 +30,13 @@ class Utils:
Fetches information about a PEP and sends it to the channel.
"""
- # Attempt to fetch the PEP from Github.
- pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.txt"
+ # 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"
+ else:
+ pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.txt"
+
+ # Attempt to fetch the PEP
log.trace(f"Requesting PEP {pep_number} with {pep_url}")
response = await self.bot.http_session.get(pep_url)