【问题标题】:Discord.js app keeps crashing on startup after uploaded new command上传新命令后,Discord.js 应用程序在启动时不断崩溃
【发布时间】:2020-04-08 08:09:18
【问题描述】:

我的 Heroku discord 机器人在启动时不断崩溃:

2019-12-15T18:19:00.891355+00:00 app[web.1]: > node index.js
2019-12-15T18:19:00.891356+00:00 app[web.1]: 
2019-12-15T18:19:01.076509+00:00 app[web.1]: .-----------------------.
2019-12-15T18:19:01.076512+00:00 app[web.1]: | Command | Load Status |
2019-12-15T18:19:01.076513+00:00 app[web.1]: |---------|-------------|
2019-12-15T18:19:01.076514+00:00 app[web.1]: | help.js | ✅           |
2019-12-15T18:19:01.076515+00:00 app[web.1]: | ban.js  | ✅           |
2019-12-15T18:19:01.076516+00:00 app[web.1]: | kick.js | ✅           |
2019-12-15T18:19:01.076520+00:00 app[web.1]: '-----------------------'
2019-12-15T18:19:59.277750+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-15T18:19:59.186024+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-12-15T18:19:59.186024+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-12-15T18:19:59.262414+00:00 heroku[web.1]: Process exited with status 22
2019-12-15T18:19:59.202593+00:00 app[web.1]: Error waiting for process to terminate: No child processes

发生了什么?只有在我上传了 kick.js 文件(如下所示)之后,它才开始这样做:

const { getMember, formatDate, moderation } = require("../../functions.js");
const { RichEmbed } = require("discord.js");
const { stripIndents } = require("common-tags");

module.exports = {
  name: "kick",
  aliases: ["kk", "mod-2"],
  category: "moderation",
  description: "Kicks A Member",
  usage: "< ID or MENTION >",
  run: async (client, message, args) => {
    if (message.deletable)
      message
        .delete()
        .catch(err =>
          message.reply(
            "Error Deleting Message! Please Contact @Floofy Boi#7555"
          )
        );
    const user = message.mentions.users.first();

    message.channel
      .send(
        moderation("kick", "test", message.guild.member(user), message.author)
      )
      .delete(10000)
      .catch(err =>
        message.reply(
          `Error! Here Is The Error: \`\`\`${err}\`\`\`\n\nMake Sure To Notify @Floofy Boi#7555`
        )
      );
  }
};

【问题讨论】:

    标签: node.js heroku discord discord.js


    【解决方案1】:

    你创建了你的 Procfile 吗?

    如果不在主目录中创建一个名为 Procfile 的文件,并且 在文件中添加这个

    worker: node index.js

    考虑到主文件是index.js

    如果你仍然想使用 web dyno,那么在 procfile 中绑定一个端口

    web: node index.js -p $PORT 其中$PORT是你要绑定的端口

    但我坚持使用worker,我现在已经使用了将近 2 年了 XD

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-11
      • 2017-10-13
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多