Struggling to acquire a channel permissions overwrite by obtaining the ID of a role stored in a variable. Any suggestions on how I can access the ID of this new role? This problem has been consuming my time for several days now.
I have experimented with the following:
const guild = client.guilds.get("server_id_here");
const role = guild.roles.find("name", `${name}`); // Successfully retrieves the necessary role
// Moving forward to where the ID is needed:
channel.permissionOverwrites({
overwrites: [{
id: role.id,
allowed: ['CONNECT', 'VIEW_CHANNEL'],
}],
reason: 'Updating so the channel is private'
});
I've also attempted options like guild.role.id
and role.id
, without any success.