For some reason whenever I assign permission overwrites for @everyone when making a channel it doesn't actually do the overwrites I select.
if (!interaction.isButton()) return
if (interaction.customId === 'ticketcreate')
{
const ticketCreation = await interaction.guild.channels.create(interaction.user.username + ' ticket', { //Create ticket channel
type: 'GUILD_TEXT',
permissionOverwrites: [
{
id: interaction.user.id,
allow: ["VIEW_CHANNEL", "READ_MESSAGE_HISTORY", "SEND_MESSAGES"]
},
{
id: interaction.guild.roles.everyone,
deny: ["VIEW_CHANNEL", "READ_MESSAGE_HISTORY"]
}
],
})
So this should make everyone in the guild not be able to view the channel or read message history and make the person that interacted with the button view the channel and read message history. However it doesn't do this. (this button creates a support ticket and I don't want everyone to be able to see the support ticket for obvious reasons)
you're passing in strings for the permissions...I believe the docs say this should be bitfield flags...here's the specs:
https://discord.js.org/#/docs/discord.js/stable/class/GuildChannelManager?scrollTo=create
and the example listed shows the code example too:
deny: [Permissions.FLAGS.VIEW_CHANNEL],
info from discordjs on Permissions: https://discordjs.guide/popular-topics/permissions.html#terminology
scroll down to Base permissions #Setting role permissions
guild.channels.create('new-channel', {
type: 'GUILD_TEXT',
permissionOverwrites: [
{
id: message.guild.id,
deny: [Permissions.FLAGS.VIEW_CHANNEL],
},
{
id: message.author.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL],
},
],
});```