如何修复 "DeprecationWarning: Collection#filterArray: use Collection#filter"?
How to fix "DeprecationWarning: Collection#filterArray: use Collection#filter"?
我正在设置一个新的 discord 机器人,并想加入一个语音频道。当我写命令 !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;
这只是一个警告,不是错误:您的代码没有受到它的影响,您可以忽略它。
GitHub (link) 上有一个未解决的问题,它说这是一个由内部使用已标记为已弃用的 discord.js 方法引起的错误。其中一位开发人员表示他们会在未来的版本中修复该问题,现在请忽略它。
我正在设置一个新的 discord 机器人,并想加入一个语音频道。当我写命令 !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;
这只是一个警告,不是错误:您的代码没有受到它的影响,您可以忽略它。
GitHub (link) 上有一个未解决的问题,它说这是一个由内部使用已标记为已弃用的 discord.js 方法引起的错误。其中一位开发人员表示他们会在未来的版本中修复该问题,现在请忽略它。