2010-01-11 24 views
0

Google Wave允许两个或更多参与者在一个wave内私下发言。当我的机器人添加到wave中时,我会识别WAVELET_SELF_ADDED事件并调用下面的方法。然而,没有任何反应。机器人如何在Google Wave中私下回复您?

由于日志中的Debug和Info语句,我可以判断代码是否被执行。 有没有任何理由为什么机器人添加时不启动私人标记?

def start_private_wavelet(properties, context): 
    """Start a private conversation between the robot and some participants.""" 
    participants = [] 
    participants.append('[email protected]') 
    participants.append('[email protected]') 

    logging.debug('Getting wave info') 

    root_wavelet = context.GetRootWavelet() 
    root_wave_id = root_wavelet.GetWaveId() 
    root_wave = context.GetWaveById(root_wave_id) 

    logging.debug('Creating private wave in %s' % root_wave_id) 

    private_wavelet = root_wave.CreateWavelet(participants) 
    message = private_wavelet.CreateBlip() 
    message.GetDocument().SetText("This is a private conversation...") 

    logging.debug('Private wave created') 
+0

我找不到它的问题。也许您可以尝试发布“外发:”操作(从您的日志中)或试用Google Wave API组:http://groups.google.com/group/google-wave-api – 2010-01-13 02:22:50

+0

您是否看到过这个工作?我刚刚搜索了论坛,发现一则帖子暗示无法通过API进行私人回复:http://bit.ly/7bSMFy – 2010-01-14 03:18:41

+1

Google员工证实目前尚不可能,但即将推出。查看上面的bit.ly链接进行跟踪。再次感谢Brian,感谢您的帮助。 – 2010-01-17 00:45:16

回答

2

私人转换通过小波创建。

因此,使用Python API,我认为您正在寻找OpBasedWave.CreateWavelet

participants = [] 
participants.append('[email protected]') 
participants.append('[email protected]') # Remember to add your robot! 

private_wavelet = root_wave.CreateWavelet(participants) 
message = private_wavelet.CreateBlip() 
message.GetDocument().SetText("Hi there, this is just a secret!") 
+0

谢谢你的回应。但是,我无法完全实现这个目标。我以为我需要将“root_wave = context.GetRootWavelet()”这一行添加到代码中,但那也行不通。也许私下创建一个小波只适用于某些事件? – 2010-01-12 03:14:22

+1

用'context.GetRootWavelet()'得到根__Wavelet__。现在你有了根小波,你可以通过'root_wave_id = root_wavelet.GetWaveId()'和'root_wave = context.GetWaveById(root_wave_id)'来找到根__Wave__。你可以在这里找到更多关于Wave实体的信息:http://code.google.com/apis/wave/guide.html#WaveEntities – 2010-01-12 03:48:19

+0

我已经将你的反馈意见整合到问题中,但是blip还没有创建。有什么我失踪? – 2010-01-13 01:03:21