Skip to content
Advertisement

distube filters not applying

I’m trying to make a discord slash commands filter using distube but when I use the slash command it didn’t apply the filter that I picked but it sent the embed when filter is applied

Node: v17.7.2

Discord: ^13.2.0

can someone help me or tell me why the filter is not applying to the current music in vc?

thank you

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] });
    }
}

Advertisement

Answer

From what I can find in the docs, it is recommended to use .setFilter() instead of calling client.distube.filters.<filter> = true.

I’d try changing your run code to use this instead and see if that works:

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],
    });
}
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement