Skip to content

Instantly share code, notes, and snippets.

@leegao
Created November 9, 2009 04:14
Show Gist options
  • Save leegao/229682 to your computer and use it in GitHub Desktop.
Save leegao/229682 to your computer and use it in GitHub Desktop.
from waveapi import events, robot
def _register(self, event):
def _wrapper(fn):
self.RegisterHandler(events.__getattribute__(event), fn)
return _wrapper
robot.Robot.register = _register
"""
#Sample usage
mybot = robot.Robot('Testbot')
@mybot.register("WAVELET_SELF_ADDED")
def OnRobotAdded(properties, context):
#Actual logic code
pass
mybot.Run()
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment