无法通过vk node bot回复消息

时间:2018-03-26 16:16:23

标签: bots

我使用Botact packdge创建了bot,它正在运行,但我经常遇到这个错误: **

(node:5744) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
    at executionItems.forEach (D:\Node\VK-sleep-bot\node_modules\botact\lib\utils\callbackHandler.js:7:35)
    at Array.forEach (<anonymous>)
    at module.exports (D:\Node\VK-sleep-bot\node_modules\botact\lib\utils\callbackHandler.js:4:18)
    at api.then.catch.err (D:\Node\VK-sleep-bot\node_modules\botact\lib\utils\executeHandler.js:15:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
(node:5744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

**

这是我的代码:

const express = require('express');
const bp = require('body-parser');  
const { Botact } = require('botact');

const app = express();
const bot = new Botact({
    token: 'c70595eee2bcec797e2e18cb10eab81d46e3ffc68caea34e4d005f231af1c733c751c1ff9cd4908722591',
    confirmation: '65a50ccd'})
bot.on(function(ctx){
    console.log(ctx.body);
    ctx.reply('Hello');
});
app.use(bp.json());

app.post('/', bot.listen);

app.listen(80);

有谁知道,我该如何解决?

0 个答案:

没有答案