Im getting the error Unhandled promise rejection: TypeError [InvalidType]: Supplied parameter is not a User nor a Role. when I try and set new channel permissions. My code looks like this:
interaction.guild.channels.cache.forEach((channel) => {
if (channel.id !== interaction.channelId) return;
let newPerms = [];
giveRoleAccess(staff, 'new', interaction).forEach((staffId) => {
newPerms.push({
id: staffId,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages]
})
channel.permissionOverwrites.set(newPerms); [error is occurring from this line]
});
The return value staffId contains either role ids or user ids
My only thought to what could be causing this issue is that I'm trying to set new permissions with role ids and user ids and maybe discord.js only allows you to set new perms with one type of id.