Avoid catchall DirectAsk

This commit is contained in:
nemunaire 2015-11-14 16:17:25 +01:00
commit e83c4091bf
2 changed files with 65 additions and 55 deletions

View file

@ -72,9 +72,11 @@ class Bot(threading.Thread):
import re
def in_ping(msg):
if re.match("^ *(m[' ]?entends?[ -]+tu|h?ear me|do you copy|ping)", msg.message, re.I) is not None:
return msg.respond("pong")
self.treater.hm.add_hook(nemubot.hooks.Message(in_ping), "in", "DirectAsk")
return msg.respond("pong")
self.treater.hm.add_hook(nemubot.hooks.Message(in_ping,
match=lambda msg: re.match("^ *(m[' ]?entends?[ -]+tu|h?ear me|do you copy|ping)",
msg.message, re.I)),
"in", "DirectAsk")
def in_echo(msg):
from nemubot.message import Text