Guys, could anyone help me make sure the bot doesn't delete the channel if someone is there? At the moment it works, but it doesn't check if anyone has entered since the command was executed, so it deletes it!
I'm not very good at API yet, I'm doing my best...
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.GuildVoiceStates
],
});
setTimeout(async () => {
if (channel.members.size === 0) {
await channel.delete();
const emptyChannelEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Salon vocal vide supprimé :x:')
.setDescription(`Le salon vocal ${channel.name} a été supprimé car il était vide.`);
await interaction.channel.send({ embeds: [emptyChannelEmbed] });
}
}, 10000);```