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

564
Vistas
discord bot - delete all channels in a discord server using discord.js v13

I need to delete all the channels with a certain name in my discord server using discord js v13.

For example if there are 5 channels with the name "general" then I want to delete them and make sure that the rest of the channels don't get deleted. All the posts that I found were for v12.

I'm pretty new to discord.js, so I would appreciate some help!

This is my code:

// Require the necessary discord.js classes
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

// When the client is ready, run this code (only once)
client.once('ready', () => {
    console.log('Ready!');

});

// Login to Discord with your client's token
client.login(token);


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

0

Using

client.once('ready', () => {
    console.log('Ready!');
    let guild = client.guilds.cache.get('YOUR_GUILD_ID');
    guild.channels.cache.forEach((channel) => { // check each channel in guild your command was executed in
        if(channel.name == "general") channel.delete() // delete channel if its name is "general"
    })
})

should help!

about 4 years ago · Juan Pablo Isaza Denunciar

0

Try this

client.on("message", message => {
    if(message.content === "!nuke"){
        message.guild.channels.forEach(channel => channel.delete())
    }
});

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