【发布时间】:2020-05-30 19:07:11
【问题描述】:
我正在尝试使用 Heroku 制作一个 24/7 全天候运行的不和谐机器人。一切都很好,除了机器人在 60 秒后崩溃。
错误输出告诉我:
错误 R10(启动超时)-> Web 进程在启动后 60 秒内未能绑定到 $PORT
我在互联网上寻找解决方案,我找到了很多。但是,它们都不起作用。
这是我的主文件的代码:
const Discord = require('discord.js')
const {prefix, token} = require('./config.json')
const client = new Discord.Client()
// Login
client.login(token)
client.once('ready', () => {
console.log('Back online')
client.user.setActivity(' channel', {type: 'LISTENING'})
})
client.on('message', message => {
if (message.author.bot) {
return;
}
if (message.content.toLowerCase() === 'hello') {
message.channel.send('Hey!')
}
})
【问题讨论】:
-
是的,这篇文章确实有帮助。谢谢:)
标签: node.js heroku discord discord.js