From aa9c6983bc2c83edc04cc86bb04aa82655470a8e Mon Sep 17 00:00:00 2001 From: int3l Date: Sun, 24 Nov 2019 01:43:08 +0200 Subject: [PATCH] Avoid conversion, match only ASCII numbers --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 58cb723..2a3da9c 100644 --- a/bot.py +++ b/bot.py @@ -295,11 +295,11 @@ def cmd_uptime(match: Match[str]) -> Response: return UptimeResponse() -@handle_message(r'!pep[ ]?(?P\d{1,4})') +@handle_message(r'!pep[ ]?(?P\d{1,4})', flags=re.ASCII) 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)}/', + match, f'https://www.python.org/dev/peps/pep-{number.zfill(4)}/', )