我正在尝试创造一个波浪机器人,我已经有了基本的工作。当有人输入@help时,我试图用help text创建一个新的blip,但由于某种原因,它没有创建它。我在日志控制台中没有收到任何错误,我看到的是信息日志'in @ log‘
def OnBlipSubmitted(properties, context):
# Get the blip that was just submitted.
blip = context.GetBlipById(properties['blipId'])
text = blip.GetDocument().GetText()
if text.startswith('@help') == True:
logging.info('in @help')
blip.CreateChild().GetDocument().SetText('help text')发布于 2009-10-18 15:35:07
出于某种原因,它才刚刚开始工作。我认为谷歌的浪潮是参差不齐的。
发布于 2009-10-19 04:42:35
如果它刚刚开始工作,我有两个建议...
-->您是否一直在更新构造函数中的Robot版本?您应该在更新更改时更改这些值,以便可以更新缓存。
if __name__ == '__main__':
myRobot = robot.Robot('waverobotdev',
image_url = baseurl + 'assets/wave_robot_icon.png',
version = '61', # <-------------HERE
profile_url = baseurl)--> Wave和AppSpot之间的服务器连接最近非常不稳定。有时AppSpot服务器接收我的事件需要几分钟的10+时间,有时需要几秒钟。验证您是否收到了预期的事件。
编辑:你提供的代码看起来不错,所以我不认为你在这方面做错了什么。
发布于 2009-10-18 08:59:05
您是否尝试过使用Append()而不是SetText()?这就是我在Python API中要做的事情--我没有使用过C# API,但我可以想象它是类似的。这是我的演示机器人的示例:
protected override void OnBlipSubmitted(IEvent e)
{
if (e.Blip.Document.Text.Contains("robot"))
{
IBlip blip = e.Blip.CreateChild();
ITextView textView = blip.Document;
textView.Append("Are you talking to me?");
}
}这很好用。
编辑:这是从上面的代码得到的JSON:
{
"javaClass": "com.google.wave.api.impl.OperationMessageBundle",
"version": "173784133",
"operations": {
"javaClass": "java.util.ArrayList",
"list": [
{
"javaClass": "com.google.wave.api.impl.OperationImpl",
"type": "BLIP_CREATE_CHILD",
"waveId": "googlewave.com!w+PHAstGbKC",
"waveletId": "googlewave.com!conv+root",
"blipId": "b+Iw_Xw7FCC",
"index": -1,
"property": {
"javaClass": "com.google.wave.api.impl.BlipData",
"annotations": {
"javaClass": "java.util.ArrayList",
"list": []
},
"lastModifiedTime": -1,
"contributors": {
"javaClass": "java.util.ArrayList",
"list": []
},
"waveId": "googlewave.com!w+PHAstGbKC",
"waveletId": "googlewave.com!conv+root",
"version": -1,
"parentBlipId": null,
"creator": null,
"content": "\nAre you talking to me?",
"blipId": "410621dc-d7a1-4be5-876c-0a9d313858bb",
"elements": {
"map": {},
"javaClass": "java.util.HashMap"
},
"childBlipIds": {
"javaClass": "java.util.ArrayList",
"list": []
}
}
},
{
"javaClass": "com.google.wave.api.impl.OperationImpl",
"type": "DOCUMENT_APPEND",
"waveId": "googlewave.com!w+PHAstGbKC",
"waveletId": "googlewave.com!conv+root",
"blipId": "410621dc-d7a1-4be5-876c-0a9d313858bb",
"index": 0,
"property": "Are you talking to me?"
}
]
}
}这与你的机器人出来的JSON相比怎么样?
https://stackoverflow.com/questions/1584406
复制相似问题