1

我正在设置一个新的不和谐机器人,并想加入一个语音频道。当我编写命令!join时,终端向我发送此消息:

DeprecationWarning: Collection#filterArray: use Collection#filter instead.
const commando = require('discord.js-commando');

class JoinChannelCommand extends commando.Command {
  constructor(client) {
    super(client, {
      name: 'join',
      group: 'music',
      memberName: 'join',
      description: 'Joins the voice channel of the commander'
    });
  }

  async run(message, args) {
    if (message.member.voiceChannel) {
      if (!message.guild.voiceConnection) {
        message.member.voiceChannel.join()
          .then(connection => {
            message.reply("Successfully Joined!");
          });
      }
    } else {
      message.reply("You must be in a vocie channel to summon me!");
    }
  }
}

module.exports = JoinChannelCommand;
4

1 回答 1

0

这只是一个警告,而不是错误:您的代码不受它的影响,您可以忽略它。
GitHub (链接) 上有一个未解决的问题,它说这是由内部使用已标记为已弃用的 discord.js 方法引起的错误。一位开发人员表示,他们将在未来的版本中解决这个问题,现在忽略它。

于 2019-01-19T13:40:33.023 回答