Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
los permisos de canal sobrescriben no funcionan a pesar de que el bot dice que funciona, discord.js

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; } } } }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!