Files
FWS-DiscordBot/src/ui/embeds.js
T

56 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { EmbedBuilder } from 'discord.js';
import { BOT_NAME, COLORS } from '../config/constants.js';
/**
* Bot voice — one tone everywhere (M12-T02). Every user-facing string in the project follows
* these rules, so the messages stay consistent as commands are added:
*
* - Informal French, short sentences, active voice; never a reproach or irony.
* - The title states the outcome, the description says what to do next.
* - One emoji per title, never decorative inside the body.
* - No gendered agreement on a person: "tu es propriétaire", "ce membre", "l'équipe",
* "la personne" — never "il / elle", "cher / chère", "ravi·e".
* - An error explains the cause, recalls the rule and offers the way out.
* - Same vocabulary across modules: équipe, membre, salon, ticket, motif.
*/
export const TONE = Object.freeze({
success: '✅ C’est fait',
error: '❌ Oups',
warning: '⚠️ Attention',
advice: '💡 Bon à savoir',
});
/** Base embed with the shared FWS-Bot visual identity (M12-T02). */
export function baseEmbed(color = COLORS.primary) {
return new EmbedBuilder().setColor(color).setFooter({ text: BOT_NAME }).setTimestamp();
}
export function infoEmbed(title, description) {
return baseEmbed(COLORS.info).setTitle(title).setDescription(description);
}
export function successEmbed(description, { title = TONE.success } = {}) {
return baseEmbed(COLORS.success).setTitle(title).setDescription(description);
}
export function warningEmbed(description, { title = TONE.warning } = {}) {
return baseEmbed(COLORS.warning).setTitle(title).setDescription(description);
}
export function errorEmbed(description, { title = TONE.error } = {}) {
return baseEmbed(COLORS.error).setTitle(title).setDescription(description);
}
/** Uniform list marker, so every embed lists things the same way. */
export function bullets(lines) {
return lines
.filter(Boolean)
.map((line) => `• ${line}`)
.join('\n');
}
/** Adds the "what you can do now" line that most replies end with. */
export function withHint(description, hint) {
return hint ? `${description}\n\n${hint}` : description;
}