Big improves
This commit is contained in:
parent
2e7a201d66
commit
daf4753907
4
main.py
4
main.py
|
|
@ -59,7 +59,7 @@ class ClientWrapper(object):
|
||||||
self._hooks = OrderedDict()
|
self._hooks = OrderedDict()
|
||||||
|
|
||||||
def add_hook(self, pattern, callback):
|
def add_hook(self, pattern, callback):
|
||||||
self._hooks[re.compile(pattern)] = callback
|
self._hooks[pattern] = callback
|
||||||
|
|
||||||
def listen(self):
|
def listen(self):
|
||||||
feed = message_stream(self._slack)
|
feed = message_stream(self._slack)
|
||||||
|
|
@ -74,7 +74,7 @@ class ClientWrapper(object):
|
||||||
text = msg['text'].strip()
|
text = msg['text'].strip()
|
||||||
success = False
|
success = False
|
||||||
for regex, callback in self._hooks.items():
|
for regex, callback in self._hooks.items():
|
||||||
match = regex.match(text)
|
match = re.match(regex, text, flags=re.IGNORECASE)
|
||||||
if match:
|
if match:
|
||||||
success = True
|
success = True
|
||||||
print("Matched on callback {}".format(callback))
|
print("Matched on callback {}".format(callback))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue