Estoy creando un comando de barra inclinada para sobrescribir los permisos en un canal de texto privado para que cuando se llame al comando, el usuario especifique un canal y una función y esa función sea la única que podrá ver ese canal. Estoy usando el administrador de sobrescritura de permisos para lograr esto, pero cuando se ejecuta el comando, dirá que funcionó, pero cuando verifico el canal, nada ha cambiado. Mi código para este comando está debajo. ¿Qué estoy haciendo mal?
const { Permissions } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('givechannel') .setDescription('Give an existing role to a channel') .addChannelOption((option) => option .setName('target') .setDescription('Channel to give the role to') ) .addRoleOption(option => option .setName('role') .setDescription('role to give the channel') ), async execute(interaction) { const channel = interaction.options.getChannel("target"); const role = interaction.options.getRole("role"); const name = interaction.guild.channels.cache.get(channel.id); const id = interaction.guild.roles.cache.get(role.id); if (!name) { interaction.reply({ content: `That channel does not exist in the server!`, ephemeral: true}); return; } if (!id) { interaction.reply({ content: `That role does not exist in the server!`, ephemeral: true }) } if (!interaction.member.permissions.has([Permissions.FLAGS.ADMINISTRATOR])) { interaction.reply({ content: `You don't have the permissions to give roles!`, ephemeral: true}); return; } else { try { await interaction.channel.permissionOverwrites.edit( role, { VIEW_CHANNEL: true }); interaction.reply({ content: `${channel} has been given ${role} role!`, ephemeral: true}); } catch(err) { console.log(err) interaction.reply({ content: `Failed to give ${role} to ${channel}!`, ephemeral: true }); return; } } } }