Skip to content

Instantly share code, notes, and snippets.

@cjac
Created July 15, 2016 19:02
Show Gist options
  • Save cjac/1f58d8f377f33494a87c178323e0cb8e to your computer and use it in GitHub Desktop.
Save cjac/1f58d8f377f33494a87c178323e0cb8e to your computer and use it in GitHub Desktop.
Class Foo(threading.Thread):
def __init__(self, ircbot, config):
# ...
self.handlers = {'comment-added': self.comment_added,
'patchset-created': self.patchset_created,
'change-merged': self.change_merged,
'ref-updated': self.ref_updated}
# ...
def _read(self, event):
...
self.handlers[event['type']](channel, event)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment