Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

567
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda