首页 > 解决方案 > 收到错误“TypeError:events.listenForEvents 不是函数”

问题描述

我在下面有这段代码,我收到错误“TypeError:events.listenForEvents 不是函数”。我的脚本可能有什么问题?谢谢你!

const { App, LogLevel } = require('@slack/bolt')
const clientOptions = {
  // enable this for dev instance
  // slackApiUrl: 'https://dev.slack.com/api/'
}

const port = process.env.PORT
// Log level is one of the options you can set in the constructor
const app = new App({
  socketMode: true,
  appToken: process.env.SLACK_APP_TOKEN,
  clientOptions,
  token: process.env.SLACK_BOT_TOKEN
  // logLevel: LogLevel.DEBUG
})

const events = require('./events')
const interactions = require('./interactions')
 
events.listenForEvents(app)
interactions.listenForInteractions(app)

app.start(function () {
  console.log(`Bot started`)
})```

标签: javascriptnode.jsslack

解决方案


推荐阅读