node.js - 在heroku中运行时命令处理程序不起作用
问题描述
discord js 的命令处理程序在 Heroku 中运行时不起作用,但在本地运行时起作用。收到的大多数错误是由于程序无法识别模块
示例命令:
module.exports = {
name: '8ball',
description: '8ball',
execute(receivedMessage, args) {
if (args.length == 0) return
receivedMessage.channel.send(response.ball())
}
}
上述命令错误:
2020-10-25T13:04:07.355215+00:00 app[web.1]: receivedMessage.channel.send(response.ball())
2020-10-25T13:04:07.355216+00:00 app[web.1]: ^
2020-10-25T13:04:07.355216+00:00 app[web.1]:
2020-10-25T13:04:07.355217+00:00 app[web.1]: ReferenceError: response is not defined
在上面的代码中,'response' 是一个自定义模块。虽然在使用 discord API 模块时会引发相同的错误。
解决方案
推荐阅读
- python - 为什么我的损失和准确度图有点不稳定?
- c# - unity If & else 语句
- c++ - 可变参数模板的静态继承
- json - Pyspark 从 S3 存储桶的子目录中读取所有 JSON 文件
- azure - 如何在 Azure 发布期间打开/关闭 https?
- css - 手势在文本区域或输入中开始时的触摸动作行为
- sql - 我可以对 PRIMARY KEY 使用什么样的附加约束?
- reactjs - .htaccess 设置以允许反应路由器工作而不阻止 API 调用服务器
- javascript - 当路径有斜杠时,通过 URL 的角度路由失败
- ios - NFC 在同一会话 NFCCore 中发送 Mifare 命令和 NDEF