Discord bot sends response twice

风流意气都作罢 提交于 2021-02-11 13:41:40

问题


I'm coding a discord.js bot, and whenever I send a command, it gives a response twice. I've concluded it's because I have too many instances running. I try to delete the instances, but it doesn't delete. Sometimes it says "Some instances could not be deleted", and sometimes it doesn't delete at all.

And through Terminal

SERVICE  VERSION          ID                                VM_STATUS  DEBUG_MODE
default  20191208t223728  aef-default-20191208t223728-0l57  RUNNING
default  20191208t223728  aef-default-20191208t223728-jb53  RUNNING
default  20191208t223728  aef-default-20191208t223728-wpgm  RUNNING

This is what the messages look like. There should only be one message, not three.

Here is what my package.json looks like:

  "name": "discord-bot",
  "version": "1.0.0",
  "description": "Custom bot for Chinese Discord server.",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "dev": "nodemon index.js",
    "build": "next build"
  },
  "keywords": [],
  "author": "Jacob Villorente",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.4.2",
    "discord.js-commando": "^0.10.0",
    "dotenv": "^7.0.0",
    "express": "^4.17.1",
    "node-fetch": "^2.6.0",
    "ytdl-core": "^1.0.3"
  },
  "devDependencies": {
    "nodemon": "^1.18.11"
  }
}

Any help would be greatly appreciated. Thank you


回答1:


There are two ways to resolve your problem. The first one, and the better, is to use grep to get all your node processes who are running on your machine:

ps -ef | grep node

Then, you will be able to kill them with kill command.

The second way is to change your discord bot token. All the instances will be errored so you're sure there's no instance launched anymore.



来源:https://stackoverflow.com/questions/59255439/discord-bot-sends-response-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!