Fix non-ascii number codes in !pep

This commit is contained in:
Anthony Sottile 2019-11-23 15:47:20 -08:00
parent ef31a9ec0e
commit 172b8d5dac
1 changed files with 2 additions and 3 deletions

5
bot.py
View File

@ -298,9 +298,8 @@ def cmd_uptime(match: Match[str]) -> Response:
@handle_message(r'!pep[ ]?(?P<pep_num>\d{1,4})')
def cmd_pep(match: Match[str]) -> Response:
*_, number = match.groups()
return MessageResponse(
match, f'https://www.python.org/dev/peps/pep-{int(number).zfill(4)}/',
)
n = str(int(number)).zfill(4)
return MessageResponse(match, f'https://www.python.org/dev/peps/pep-{n}/')
COMMAND_RE = re.compile(r'!\w+')