Google 聊天机器人在太空中提及用户
我有一个聊天机器人,我试图让机器人提及空间中的用户。例如,我们有:
@googlechatBot 你好
用户说“@googlechatBot 你好”
但我希望您在答案中提及该用户。类似的东西
@googlechatBot 你好
@User 说“@googlechatBot 你好”
我使用的代码来自文档中找到的模板。
function onMessage(event) {
var name = "";
if (event.space.type == "DM") {
name = "You";
} else {
name = event.user.displayName;
}
var message = name + " said \"" + event.message.text + "\"";
return { "text": message };
}
I have a chatbot and I am trying to make the bot mention a user in a space. For example, we have:
@googlechatBot Hello
User said "@googlechatBot Hello"
But I would like you to mention the user in the answer. Something like that
@googlechatBot Hello
@User said "@googlechatBot Hello"
The code I use is from the template found in the documentation.
function onMessage(event) {
var name = "";
if (event.space.type == "DM") {
name = "You";
} else {
name = event.user.displayName;
}
var message = name + " said \"" + event.message.text + "\"";
return { "text": message };
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过这种方法吗?
如此处所述 https://developers.google .com/chat/api/guides/message-formats/basic?hl=en#messages_that_mention_specific_users
Did you tried this approach?
As described here https://developers.google.com/chat/api/guides/message-formats/basic?hl=en#messages_that_mention_specific_users