distube 过滤器不适用

distube filters not applying

我正在尝试使用 distube 制作一个 discord slash 命令过滤器,但是当我使用 slash 命令时,它没有应用我选择的过滤器,但它在应用过滤器时发送了嵌入

节点: v17.7.2

不和谐:^13.2.0

有人可以帮助我或告诉我为什么过滤器不适用于 vc 中的当前音乐吗?

谢谢

const { MessageEmbed } = require('discord.js');
const ee = require('../../config.json');

module.exports = {
    name: 'filter',
    description: 'Add filter.',
    usage: 'filter',
    options: [
        {
            name: 'preset',
            description: 'Filters to add.',
            type: 'STRING',
            required: true,
            choices: [
                {
                    name: 'BassBoost',
                    value: 'bassboost'
                },
                {
                    name: 'Nightcore',
                    value: 'nightcore'
                },
                {
                    name: 'Vaporwave',
                    value: 'vaporwave'
                }
            ]
        }
    ],

    run: async(client, interaction, args) => {
        const filterss = interaction.options.getString('preset');
        const queue = client.distube.getQueue(interaction);

        let player = client.distube.filters;

        if(!queue) {
            return interaction.followUp({embeds: [
                new MessageEmbed()
                    .setColor(ee.color)
                    .setAuthor({name: 'Error', iconURL: 'https://i.imgur.com/81ig9jl.jpg'})
                    .setDescription('No songs are playing!')
            ]})
        }

        let thing = new MessageEmbed().setColor(ee.color);

        if (filterss == "nightcore") {
            thing.setDescription("✅ | Nightcore filter is now active!");
            player.nightcore = true;
        } else if (filterss == "bassboost") {
            thing.setDescription("✅ | BassBoost filter is now on!");
            player.bassboost = true;
        } else if (filterss == "vaporwave") {
            thing.setDescription("✅ | Vaporwave filter is now on!");
            player.vaporwave = true;
        }
        return interaction.followUp({ embeds: [thing] });
    }
}

根据我在文档中找到的内容,建议使用 .setFilter() 而不是调用 client.distube.filters.<filter> = true

我会尝试更改您的 run 代码以改用它,看看是否可行:

run: async(client, interaction, args) => {
    // Your queue check code here

    let thing = new MessageEmbed().setColor(ee.color);

    if (filterss == 'nightcore') {
        thing.setDescription('✅ | Nightcore filter is now active!');
        client.distube.setFilter(interaction, filterss);
    } else if (filterss == 'bassboost') {
        thing.setDescription('✅ | BassBoost filter is now on!');
        client.distube.setFilter(interaction, filterss);
    } else if (filterss == 'vaporwave') {
        thing.setDescription('✅ | Vaporwave filter is now on!');
        client.distube.setFilter(interaction, filterss);
    }
    return interaction.followUp({
        embeds: [thing],
    });
}