discord.js - Application bot not working properly

26 Views Asked by At

I followed a tutorial on how to make a application bot but it only sends the first question and when I reply it does not send the second question. I tried changing around interaction.member to interaction.user and ive searched everywhere but I cannot find a fix

Here's the code:

module.exports = {
    data: new SlashCommandBuilder()
    .setName('apply')
    .setDescription('Apply to be a Citivas'),
    run: async ({ interaction }) => {
        interaction.reply({
            content: 'Sent the application in your DMs',
            ephemeral: true,
        });

        const questions = [
            "Why should we accept u",
            "Are you good",
            "Test1",
            "222",
            "Test3",
        ];

        let collectCounter = 0;
        let endCounter = 0;

        const filter = (m) => m.author.id === interaction.member.id;

        const appStart = await interaction.member.send(questions[collectCounter++]);
        const channel = appStart.channel;

        const collector = channel.createMessageCollector(filter);

        collector.on('collect', () => {
            if (collectCounter < questions.length) {
                channel.send(questions[collectCounter++])
            } else {
                channel.send('Your application has been sent.')
                collector.stop('fulfilled');
            }
        });
    }
}
0

There are 0 best solutions below