问题
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