Give user permissions to discord channel discord.js

Viewed 28

I want to add a user to a channel by the users discord id. What I've tried has failed and I am wondering if anyone knows how.

I want to have a button interaction, after the button is clicked run a function that gives a user permissions based on what user id is in the variable.

interaction.guild.channels.cache.forEach((channel) => {
    if (channel.id === interaction.channelId) {
        channel.permissionOverwrites.edit('784219231481888798', { VIEW_CHANNEL: true, SEND_MESSAGES: true });
    }
})

This throws an error^

0 Answers
Related