PermissionOverwrites throws TypeError

Viewed 22

I was trying to create a channel with the following properties:

interaction.guild.channels.create("candidatura_"+interaction.user.username, {
        type: "text",
        topic: `User ID: ${interaction.user.id}`,
        parent: "973307350947594310", //Settare la categoria,
        permissionOverwrites: [
            {
                id: interaction.guild.id,
                deny: ["VIEW_CHANNEL"]
            },
            {
                id: interaction.user.id,
                allow: ["VIEW_CHANNEL"]
            },
            { //Aggiungere altri "blocchi" se si vogliono dare permessi anche a ruoli o utenti
                id: "958431471952101386",
                allow: ["VIEW_CHANNEL"]
            }
        ]
    })

The problem is, the following code throws a TypeError, the error is the following:

/home/luca/Bot Discord/TicketBot/node_modules/discord.js/src/structures/PermissionOverwrites.js:184
if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
                       ^
TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.

Does anyone have any idea of what the problem could be? I tried removing the permissionOverwrites parameter and it works fine, but of course I want the permissions to be set.

0 Answers
Related