Deleting all channels doesn't work discord.js

Viewed 27

I'm coding a bot that deleting all channels of a Discord server. Here my code :

const { Client, GatewayIntentBits } = require("discord.js");

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
  ],
});

client.on("ready", () => {
  console.log("Bot Ready");
});

client.on("messageCreate", (message) => {
  if (message.author.bot) return;

  console.log(message);
  if (message.content === ".setup") {
    message.guild.channels.forEach((channel) => channel.delete());
  }
});

client.login(
  "token"
);

When I launch it and I execute the command, nothing is happening. My bot is Administrator.

Someone can help me please ?


Alden Vacker

0 Answers
Related