added pep command to quickly get the link to a PEP

This commit is contained in:
Hayden Young 2019-11-16 22:07:27 +00:00
parent 54307e600b
commit 0e68e0efe7
1 changed files with 10 additions and 0 deletions

10
bot.py
View File

@ -295,6 +295,16 @@ def cmd_uptime(match: Match[str]) -> Response:
return UptimeResponse() return UptimeResponse()
@handle_message('!pep')
def cmd_pep(match: Match[str]) -> Response:
_, _, msg = match.groups()
_, _, rest = msg.partition(' ')
return MessageResponse(
match,
f'https://www.python.org/dev/peps/pep-{rest.zfill(4)}/',
)
COMMAND_RE = re.compile(r'!\w+') COMMAND_RE = re.compile(r'!\w+')
SECRET_CMDS = frozenset(('!settoday',)) SECRET_CMDS = frozenset(('!settoday',))