Closed gspxrk closed 7 months ago
i was dumb for merged this pr and not check them properly, actually the code was fine
try {
const id = interaction.options.getString('id');
if (id.toLowerCase() === 'list') {
try {
const guildList = client.guilds.cache.map(guild => `${guild.name} | ${guild.id}`).join('\n');
return interaction.reply({ content: `Guilds:\n\`${guildList}\``, ephemeral: true });
} catch (error) {
console.error('Error listing guilds:', error);
return interaction.reply({ content: `Check console for list of guilds`, ephemeral: true });
}
}
const guild = client.guilds.cache.get(id);
if (!guild) {
return interaction.reply({ content: `\`${id}\` is not a valid guild ID`, ephemeral: true });
}
try {
await guild.leave();
return interaction.reply({ content: `Left guild \`${id}\``, ephemeral: true });
} catch (error) {
console.error(`There was an error trying to leave guild ${id}:`, error);
return interaction.reply({ content: `Error leaving guild.`, ephemeral: true });
}
there is already try {
at the top so adding another one broke the code
if you get an error from this command then send the log here
When you forgot to review code moment
i fix code