Discord bot两次发送响应 [英] Discord bot sends response twice
问题描述
我正在编码一个discord.js机器人,每当我发送命令时,它都会给出两次响应.我得出结论,这是因为我正在运行太多实例.我尝试删除实例,但不会删除.有时它说某些实例无法删除",有时它甚至根本不删除.
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.
并通过终端
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
这是我的package.json的样子:
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
推荐答案
有两种方法可以解决您的问题.第一个,也是更好的选择,是使用 grep 来获取在计算机上运行的所有节点进程:
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
然后,您将可以使用 kill
命令将其杀死.
Then, you will be able to kill them with kill
command.
第二种方法是更改您的不一致bot令牌.所有实例都会出错,因此您确定没有实例启动了.
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.
这篇关于Discord bot两次发送响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!