#Collectors not working

9 messages · Page 1 of 1 (latest)

rough shadow
#

This collector worked for me on discord.js v13, but after rewriting the whole bot on v14 it suddenly stopped working (bot sees interactions because the initial console.logs work, but the bot doesn't want to edit messages and add the tagged channel to the database)

steel edgeBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

rough shadow
#
const { EmbedBuilder } = require("discord.js");
module.exports = {
    customId: `settings-menu`,
    type: "select",

    run: async (client, interaction) => {
        const embed = new EmbedBuilder()
            .setDescription(`Please mention your announcement channel, or enter its ID`)
            .setColor("Blurple")
        await interaction.reply({ embeds: [embed] })

        let filter =  m => m.author.id === interaction.user.id;
        const collector = interaction.channel.createMessageCollector({ filter, time: 15000 });

        collector.on('collect', async m => {
            const channel = m?.mentions?.channels?.first() || m?.guild?.channels?.cache?.get(m?.content)
            if (!channel?.id) {
                return interaction.channel.send(`${interaction.user.tag}, It's not channel!`)
            }

            const get = await client.prisma.guild.findFirst({ where: { id: interaction.guild.id } })

            await client.prisma.guild.upsert({
                where: {
                    id: interaction.guild.id
                },
                create: {
                    id: interaction.guild.id,
                    broadcastChannel: channel.id
                },
                update: {
                    broadcastChannel: channel.id
                }
            })

            const embedSuccessfully = new EmbedBuilder()
                .setDescription(`Successfully added broadcast channel to database!\nNew value: ${channel.name} (<#${channel.id}>)\nYou have a few seconds to change your channel. `)
                .setColor("Green")
            await interaction.editReply({ embeds: [embedSuccessfully] });
        });

        collector.on('end', async collected => {
            await interaction.editReply( { content: "Your time to complete the options is over.", embeds: [] })
            collector.stop()
        });
    }
}
#

(No error in console)

loud quail
rough shadow
#

wait

rough shadow
#

sorry

#

thanks for reminder