我最近使用开关盒改写了我的机器人,现在它不响应命令

时间:2020-09-19 09:07:07

标签: discord discord.js bots

我最近使用开关盒改写了我的机器人 但是现在它不响应命令 相反,它只是坐在那儿什么都不做

以下是代码的链接:https://sourceb.in/ff321fd803

1 个答案:

答案 0 :(得分:-1)

问题在这里

const args = msg.content.slice('2').trim().split(' ');
const command = args.shift().toLowerCase();
  • Slice最好将数字而不是字符串作为参数,因为如果无法将其转换为数字,则可能导致错误
  • 由于您已从其中删除了命令,因此无法使用args变量访问“命令”。
  • Args定义不清。

使用此:

const args = msg.content.split(' ').slice(1)
const command = msg.content.split(' ').shift().toLowerCase()