Fix matching at not beginning of string
This commit is contained in:
parent
5564c7413a
commit
54307e600b
2
bot.py
2
bot.py
|
|
@ -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(f'gnu[/+]{word}', msg, flags=re.IGNORECASE)
|
query = re.search(f'gnu[/+]{word}', msg, flags=re.IGNORECASE)
|
||||||
if query:
|
if query:
|
||||||
return MessageResponse(match, f'YES! {query[0]}')
|
return MessageResponse(match, f'YES! {query[0]}')
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue