- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我希望我的 recast.bot 回复用户的回复。这是代码,但我收到以下错误消息。如何解决这个问题?
Bot Server is running on port 5002
TypeError: Cannot read property 'attachment' of undefined
at new Message (C:\FD\Node\node_modules\recastai\lib\apis\resources\message.js:66:31)
at Connect.handleMessage (C:\FD\Node\node_modules\recastai\lib\apis\connect\index.js:49:30)
at C:\FD\Node\ct2Nbot.js:28:19
at Layer.handle [as handle_request] (C:\FD\Node\node_modules\express\lib\router\layer.js:95:5)
at next (C:\FD\Node\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\FD\Node\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\FD\Node\node_modules\express\lib\router\layer.js:95:5)
at C:\FD\Node\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\FD\Node\node_modules\express\lib\router\index.js:335:12)
at next (C:\FD\Node\node_modules\express\lib\router\index.js:275:10)
const express = require('express');
const bodyParser = require('body-parser');
const recastai = require('recastai').default;
const build = new recastai.build('xxxxxx', 'en');
var client = new recastai('xxxxxx')
const app = express();
const port = 5002;
app.use(bodyParser.json());
app.post('/', function(req, res) {
client.connect.handleMessage(req, res, onMessage)
})
app.listen(port, () => {
console.log('Bot Server is running on port ' + port);
})
function onMessage (message) {
var content = message.content
var type = message.type
message.addReply([{ type: 'text', content: 'Hello, world' }])
message.reply()
.then(res => console.log('message sent'))
}
最佳答案
在 handlemessage 函数中,您正在使用获取消息有效负载中不存在的 .attachment 属性。使用新的构建器,您可以直接在构建器中管理这些消息,而无需事先构建后端
关于artificial-intelligence - 重铸.ai : TypeError: Cannot read property 'attachment' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53376089/
我正在尝试创建一个简单的国际象棋程序,但在实现典当推广时遇到了一些小问题。我有一个抽象类 Piece 和扩展它的 6 个类(King、Queen、Rook、Knight、Bishop 和 Pawn)。
这个问题在这里已经有了答案: Convert data from long format to wide format with multiple measure columns (5 个回答) 3年
我正在使用具有 A* 寻路算法的库 (libtcod)。我的类继承了回调基类,我实现了需要的回调函数。这是我的通用示例: class MyClass : public ITCODPathCallbac
在配置重铸机器人时,有没有办法设置一个操作来重置除特定字段之外的所有内存? 我已经尝试取消设置除我需要的字段之外的所有字段,但它很无聊、不可扩展、不可扩展且不可维护。 谢谢 最佳答案 您应该在 Rec
我希望我的 recast.bot 回复用户的回复。这是代码,但我收到以下错误消息。如何解决这个问题? Bot Server is running on port 5002 TypeError: Can
我是一名优秀的程序员,十分优秀!