Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Discord.js | Multiple channel permission - Everyone & created role

I would like to create a channel with specific permissions for @everyone and a created role. So I defined the role as " rolee " and the @everyone at " everyoneRole ", I would like @everyone not to have permission to see the room, and the rolee created before to have permission to see, talk, log in and talk in the room (category type room, but permission is the same).

My code will surely be more concrete: by the way, discord.js is a bit tricky because it only accepts the code if everything is perfectly aligned, which in itself is not a problem, but is when the script doesn't work because of a single misplaced space.

let everyoneRole = message.guild.roles.cache.find(role => role.name === '@everyone');
let rolee = message.guild.roles.cache.find(role => role.name === rolename);

let crole = (
    message.guild.roles.create({
        data: {
            name: rolename,
            color: '3498DB',
        },
    });
);
let cat = (
    message.guild.channels.create(category, {
        type: "category",
        position: 999,
        permissionOverwrites: [
           {
               id: everyoneRole.id,
               deny: [
                   'VIEW_CHANNEL',
                   'SEND_MESSAGES',
               ],
           },
       ]
   });
);

And here is the error message.

My problem is that it refuses to add multiple permission to a single role (allow : ['VIEW_CHANNEL', 'SEND_MESSAGES']).

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Note: This answer is for Discord.js v13.3.0


The TypeError is occurring because when you're getting the role from the list of roles, @everyone is technically not a role. While it is a role, you can't get it by requesting it from the role cache.

// When you try to get it from this, Discord.js returns null
let everyoneRole = message.guild.roles.cache.find(role => role.name === '@everyone');

This means that you're handing Discord an empty ID which then causes the issue. The proper way to get the role for everyone, as pointed out by Niet the Dark Absol, is to use <Guild>.roles.cache.everyone (Replace <Guild> with whatever your Guild variable is). Here's what that would look like.

let everyoneRole = message.guild.roles.cache.everyone
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda