import { SlashCommandBuilder, MessageFlags } from "discord.js" import type { ChatInputCommandInteraction } from "discord.js" import { t } from "@/utils/i18n" export const data = new SlashCommandBuilder() .setName("update") .setDescription("Update the member count channel") .setDescriptionLocalizations({ fr: "Mettre à jour le canal de nombre de membres" }) export async function execute(interaction: ChatInputCommandInteraction) { const guild = interaction.guild if (!guild) return interaction.reply({ content: t(interaction.locale, "common.command_server_only"), flags: MessageFlags.Ephemeral }) guild.members.fetch().then(async () => { let i = 0 guild.members.cache.forEach(member => { if (!member.user.bot) i++ }) const channel = guild.channels.cache.get("1091140609139560508") if (!channel) return await channel.setName(`${i} Gens Posés`) return interaction.reply(t(interaction.locale, "salonpostam.update.members_updated", { count: i })) }).catch(console.error) }