Should a python robot receive "BLIP_SUBMITTED" every time I click
"done" on a new blip? (Or under what circumstances?) I'm not seeing
the event. (I searched the group, but did not find anything recent
about this event.)
Here's my python code in full; it's really just the example code with
"blip submitted" event handlers added. I also tried some code from
the forums used to set the wave title from blip contents, but it still
didn't work. (Perhaps the robot submitting a blip in response creates
an infinite loop, so I tried the set-title method instead.)
---------------------------------
from waveapi import events
from waveapi import model
from waveapi import robot
def OnParticipantsChanged(properties, context):
"""Invoked when any participants have been added/removed."""
added = properties['participantsAdded']
for p in added:
Notify(context)
def OnRobotAdded(properties, context):
"""Invoked when the robot has been added."""
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("I'm alive!")
def OnBlipCreated(properties, context):
"""Invoked when a blip is created."""
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("I see there's a
new blip...")
def OnBlipSubmitted(properties, context):
"""Invoked when a blip is created."""
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("Blip submitted,
eh?")
def Notify(context):
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("Hi everybody!")
if __name__ == '__main__':
myRobot = robot.Robot('sylowRobotZero',
image_url='http://myapp.appspot.com/
icon.png',
version='1',
profile_url='http://myapp.appspot.com/')
myRobot.RegisterHandler(
events.WAVELET_PARTICIPANTS_CHANGED, OnParticipantsChanged)
myRobot.RegisterHandler(
events.WAVELET_SELF_ADDED, OnRobotAdded)
myRobot.RegisterHandler(
events.WAVELET_BLIP_CREATED, OnBlipCreated)
myRobot.RegisterHandler(
events.BLIP_SUBMITTED, OnBlipSubmitted)
myRobot.Run()
--
You received this message because you are subscribed to the Google Groups
"Google Wave API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-wave-api?hl=en.