Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
Fix event routing
Browse files Browse the repository at this point in the history
  • Loading branch information
ovv committed Dec 17, 2017
1 parent 66f128b commit b81136f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions slack/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ def dispatch(self, event):
Yields:
handler
"""
LOG.debug('Dispatching event %s', event.get('type'))
for detail_key, detail_values in self._routes.get(event.get('type')):
event_value = event.get(detail_key, '*')
callbacks = detail_values.get(event_value, [])
for callback in callbacks:
yield callback
LOG.debug('Dispatching event "%s"', event.get('type'))
if event['type'] in self._routes:
for detail_key, detail_values in self._routes.get(event['type'], {}).items():
event_value = event.get(detail_key, '*')
callbacks = detail_values.get(event_value, [])
for callback in callbacks:
yield callback
else:
return

0 comments on commit b81136f

Please sign in to comment.