'TypeError: client.commands.filtrer is not a function

Hello I have a problem with my discord help command. When I start the bot and I send the command, the bot crash with this error : TypeError: client.commands.filtrer is not a function

Can u help me please Cuz idk how to do something else.

The code:

        let infoembed = new MessageEmbed()
        .setColor('AQUA')
        .setTitle('Info Commands')
        .setDescription(`>>>> ${client.commands
            .filtrer((cmd) => cmd.category === 'Info')
            .map((cmd) => `\'${cmd.name}\'`)
            .join(', ')}`)


        let ModerationEmbed = new MessageEmbed()
        .setColor('AQUA')
        .setTitle('Moderation Commands')
        .setDescription(`>>>> ${client.commands
            .filtrer((cmd) => cmd.category === 'Moderation')
            .map((cmd) => `\'${cmd.name}\'`)
            .join(', ')}`)


        let OtherEmbed = new MessageEmbed()
        .setColor('AQUA')
        .setTitle('Other Commands')
        .setDescription(`>>>> ${client.commands
            .filtrer((cmd) => cmd.category === 'Other')
            .map((cmd) => `\'${cmd.name}\'`)
            .join(', ')}`)


Solution 1:[1]

I guess the client.commands you defined is an discord.js Collection. It doesn't have any method called filtrer. I think you are trying to filter the collection. So replace filtrer with filter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1