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

425
Vistas
Discord.js error "TypeError: channel.updateOverwrite is not a function"

When I'm trying to change the channel permissions to lock users from sending messages, this error pops up no matter what I do.

TypeError: channel.updateOverwrite is not a function

Is there anything wrong?

module.exports =
{
    async execute(message, args)
    {
            const role = message.guild.roles.cache.find(r => r.name === '@everyone')

            let channel = message.mentions.channels.first() || args[0]
            if(!channel) channel = message.channel

            if(channel.permissionsFor(message.guild.id).has('SEND_MESSAGES') === false) return message.channel.send(`${channel} is already locked.`)

            await channel.updateOverwrite(message.guild.id, { SEND_MESSAGES: false }).catch(() => {}) // Line in which the error happens
            await channel.updateOverwrite(role, { SEND_MESSAGES: false} ).catch(() => {})
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It seems you're using discord.js v13 but using some old code. In v13 the channel#updateOverwrite() method is removed and while in previous version channel#permissionOverwrites was a collection of overwrites, in v13 it's a PermissionOverwriteManager. It means, you should use its .edit() method to update overwrites:

await channel
  .permissionOverwrites.edit(message.guild.id, { SEND_MESSAGES: false })
await channel
  .permissionOverwrites.edit(role, { SEND_MESSAGES: false })
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