use proper regex

This commit is contained in:
Batuhan Taşkaya 2019-10-20 00:57:56 +03:00 committed by GitHub
parent a74f7cd8c1
commit f81261991d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

2
bot.py
View File

@ -320,7 +320,7 @@ def msg_ping(match: Match[str]) -> Response:
@handle_message(r'.*\b(nano|linux|windows|emacs)\b', flags=re.IGNORECASE) @handle_message(r'.*\b(nano|linux|windows|emacs)\b', flags=re.IGNORECASE)
def msg_gnu_please(match: Match[str]) -> Response: def msg_gnu_please(match: Match[str]) -> Response:
msg, word = match[3], match[4] msg, word = match[3], match[4]
query = re.match(fr'(?i)gnu(\/|\+){word}', msg) query = re.match(fr'gnu[/+]{word}', msg, flags=re.IGNORECASE)
if query: if query:
return MessageResponse(match, f'YES! {query.match(0)}') return MessageResponse(match, f'YES! {query.match(0)}')
else: else: