Merge pull request #16 from haydennyyy/master
added pep command to quickly get the link to a PEP
This commit is contained in:
commit
06c052a077
18
bot.py
18
bot.py
|
|
@ -295,6 +295,24 @@ 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(' ')
|
||||||
|
pep = esc(rest.zfill(4))
|
||||||
|
|
||||||
|
if not pep.isdigit():
|
||||||
|
return MessageResponse(
|
||||||
|
match,
|
||||||
|
'Please make sure you gave me a number!',
|
||||||
|
)
|
||||||
|
|
||||||
|
return MessageResponse(
|
||||||
|
match,
|
||||||
|
f'https://www.python.org/dev/peps/pep-{pep}/',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
COMMAND_RE = re.compile(r'!\w+')
|
COMMAND_RE = re.compile(r'!\w+')
|
||||||
SECRET_CMDS = frozenset(('!settoday',))
|
SECRET_CMDS = frozenset(('!settoday',))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue