From 296f3c1aa7bbf216bdd6d14b3d6877e691ba0fae Mon Sep 17 00:00:00 2001 From: nocode Date: Sun, 13 Sep 2026 12:19:12 +0200 Subject: [PATCH] feat(fws): add fws information command Refs: #35 Co-Authored-By: Claude Opus 5 (1M context) --- src/commands/fws/fws.js | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/commands/fws/fws.js diff --git a/src/commands/fws/fws.js b/src/commands/fws/fws.js new file mode 100644 index 0000000..1ee67c3 --- /dev/null +++ b/src/commands/fws/fws.js @@ -0,0 +1,57 @@ +import { SlashCommandBuilder } from 'discord.js'; +import { ACCESS_LEVELS } from '../../config/constants.js'; +import { env } from '../../config/env.js'; +import { linkButtons } from '../../ui/buttons.js'; +import { baseEmbed, notImplementedEmbed } from '../../ui/embeds.js'; + +export const access = ACCESS_LEVELS.USER; + +export const data = new SlashCommandBuilder() + .setName('fws') + .setDescription('Informations sur FWS et FWS Arch') + .addSubcommand((sub) => sub.setName('info').setDescription('Présente FWS et FWS Arch')) + .addSubcommand((sub) => sub.setName('version').setDescription('Version actuelle de FWS Arch')) + .addSubcommand((sub) => sub.setName('status').setDescription('État des services et projets')) + .addSubcommand((sub) => sub.setName('links').setDescription('Ressources officielles')) + .addSubcommand((sub) => + sub + .setName('changelog') + .setDescription("Changements d'une version") + .addStringOption((option) => option.setName('version').setDescription('Version (dernière par défaut)')), + ); + +const officialLinks = () => [ + { label: 'Site', url: env.links.website }, + { label: 'Documentation', url: env.links.docs }, + { label: 'Dépôt FWS Arch', url: env.links.archRepo }, + { label: 'Gitea', url: env.gitea.url }, + { label: 'Discord', url: env.links.discordInvite }, +]; + +const handlers = { + // TODO(M4-T01): content should come from guild_settings (M4-T07). + info: (interaction) => + interaction.reply({ + embeds: [ + baseEmbed() + .setTitle('FWS & FWS Arch') + .setDescription( + 'FWS est une organisation open source multi-projets.\n' + + "**FWS Arch** est un fork d'Arch Linux avec une surcouche conviviale.", + ), + ], + components: linkButtons(officialLinks()), + }), + links: (interaction) => + interaction.reply({ + embeds: [baseEmbed().setTitle('Liens officiels FWS')], + components: linkButtons(officialLinks()), + }), + version: (interaction) => interaction.reply({ embeds: [notImplementedEmbed('/fws version')] }), + status: (interaction) => interaction.reply({ embeds: [notImplementedEmbed('/fws status')] }), + changelog: (interaction) => interaction.reply({ embeds: [notImplementedEmbed('/fws changelog')] }), +}; + +export async function execute(interaction) { + await handlers[interaction.options.getSubcommand()](interaction); +}