Discord 机器人两次发送响应 [英] Discord bot sends response twice

查看:30
本文介绍了Discord 机器人两次发送响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 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.

第二种方法是更改​​您的不和谐机器人令牌.所有实例都会出错,因此您确定不再启动任何实例.

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 机器人两次发送响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆