Emoji click interaction

Hey,

i made code when author click on reaction get ViewChannel Permission

but i didn't work can any body help ??
                logChannel.send({ embeds: [embed] })
                .then(async (message) => {
                    // Add reaction emoji to the message
                    await message.react(':white_check_mark:');
        
                    // Await the reaction
                    const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' && user.id === interaction.user.id;
                    const collector = message.createReactionCollector({ filter, time: 15000 });
        
                    console.log("Reaction collector created.");
        
                    collector.on('collect', async (reaction, user) => {
                        console.log("Reaction collected:", reaction.emoji.name, "by user:", user.id);
        
                        // Grant view permission to the user
                        await hiddenChannel.permissionOverwrites.edit(interaction.user.id, {
                            ViewChannel: true // corrected ViewChannel to VIEW_CHANNEL
                        });
        
                        // Send a confirmation message
                        interaction.reply({
                            content: 'You have been granted permission to view the ticket channel.',
                            ephemeral: true
                        });
                    });
        
                    collector.on('end', () => {
                        console.log("Reaction collector ended.");
                        // Remove the reaction collector after 15 seconds
                        collector.stop();
                    });
                })
                .catch(error => console.error('Error sending message to log channel:', error));
        }
Was this page helpful?