0
votes

i am creating a "ticket bot" in discord.js and have got most of it working but need help with permission overwrites

the discordjs guide shows this code but when run it creates the channel but does not do permissions.

        guild.createChannel('new-channel', 'text', [
            {
                id: guild.defaultRole.id,
                deny: ['VIEW_CHANNEL'],
            },
            {
                id: user.id,
                allow: ['VIEW_CHANNEL'],
            },
        ]);
    }
1
Extra commas are present (fourth line, eighth line, ninth line). Try removing them first. - slothiful
that worked, Thanks - jontus technology

1 Answers

4
votes

i had extra commas that my linter added, with 11.5 you need to add permissionOverwrites

        guild.createChannel('new-channel', 'text',
          permissionOverwrites[
            {
                id: guild.defaultRole.id,
                deny: ['VIEW_CHANNEL']
            },
            {
                id: user.id,
                allow: ['VIEW_CHANNEL']
            }
        ]);
    }