refactor(ui): give every message one friendly, ungendered voice
Members read all replies as one voice, so the wording now lives in one place:
the shared titles, the list marker and the "what to do next" hint come from
src/ui/embeds.js, and every module follows them.
An error explains the cause, recalls the rule and offers the way out instead of
blaming; a success says what happens next. Nothing agrees on the gender of a
person ("utilisateur", "cher/chère", "ravie"), which also keeps the sentences
shorter. Two tests lock the shared titles and reject gendered descriptions.
This commit is contained in:
31 files changed
+469
-201
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS, COLORS } from '../../config/constants.js';
|
||||
import { parseChoices } from '../../services/polls/poll-service.js';
|
||||
import { baseEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.USER;
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function execute(interaction) {
|
||||
if (subcommand === 'coinflip') {
|
||||
const result = pick(['Pile', 'Face']);
|
||||
await interaction.reply({
|
||||
embeds: [baseEmbed(COLORS.info).setTitle('Pile ou face').setDescription(`🪙 ${result} !`)],
|
||||
embeds: [baseEmbed(COLORS.info).setTitle('🪙 Pile ou face').setDescription(`**${result}** !`)],
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -73,8 +73,8 @@ export async function execute(interaction) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
baseEmbed(COLORS.info)
|
||||
.setTitle(`Lancer de dé (d${sides})`)
|
||||
.setDescription(`🎲 Tu obtiens **${roll}** !`),
|
||||
.setTitle(`🎲 Lancer de dé (d${sides})`)
|
||||
.setDescription(`Tu obtiens **${roll}** !`),
|
||||
],
|
||||
});
|
||||
return;
|
||||
@@ -99,8 +99,8 @@ export async function execute(interaction) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
baseEmbed(COLORS.info)
|
||||
.setTitle('Choix aléatoire')
|
||||
.addFields({ name: 'Options', value: options.map((option) => `• ${option}`).join('\n') })
|
||||
.setTitle('🎯 Choix aléatoire')
|
||||
.addFields({ name: 'Options', value: bullets(options) })
|
||||
.setDescription(`Je choisis : **${pick(options)}**`),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -13,20 +13,29 @@ export const data = new SlashCommandBuilder()
|
||||
.setName('create')
|
||||
.setDescription('Créer un sondage')
|
||||
.addStringOption((option) =>
|
||||
option.setName('question').setDescription('Question').setRequired(true).setMaxLength(200),
|
||||
option.setName('question').setDescription('Question posée').setRequired(true).setMaxLength(200),
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option.setName('choices').setDescription('Choix séparés par ";" (2 à 10)').setRequired(true),
|
||||
option
|
||||
.setName('choices')
|
||||
.setDescription('Propositions séparées par des « ; » (2 à 10)')
|
||||
.setRequired(true),
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('minutes').setDescription('Durée en minutes').setMinValue(1).setMaxValue(10_080),
|
||||
option
|
||||
.setName('minutes')
|
||||
.setDescription('Durée avant fermeture automatique, en minutes')
|
||||
.setMinValue(1)
|
||||
.setMaxValue(10_080),
|
||||
),
|
||||
)
|
||||
.addSubcommand((sub) =>
|
||||
sub
|
||||
.setName('close')
|
||||
.setDescription('Fermer un sondage')
|
||||
.addIntegerOption((option) => option.setName('id').setDescription('ID du sondage').setRequired(true)),
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('id').setDescription('Numéro du sondage (affiché dans l’embed)').setRequired(true),
|
||||
),
|
||||
);
|
||||
|
||||
/** Polls are published in the current channel and voted with buttons (M10). */
|
||||
@@ -44,6 +53,10 @@ export async function execute(interaction) {
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
const pollId = await createPoll(interaction, { question, choicesInput, minutes });
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed(`Sondage **#${pollId}** publié dans <#${interaction.channelId}>.`)],
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`Ton sondage **#${pollId}** est en ligne dans <#${interaction.channelId}> : tout le monde vote avec les boutons.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export const data = new SlashCommandBuilder()
|
||||
const discordStatsEmbed = (interaction) => {
|
||||
const guild = interaction.guild;
|
||||
return baseEmbed()
|
||||
.setTitle(`Statistiques — ${guild.name}`)
|
||||
.setTitle(`📊 Statistiques — ${guild.name}`)
|
||||
.setThumbnail(guild.iconURL({ size: 128 }))
|
||||
.addFields(
|
||||
{ name: 'Membres', value: String(guild.memberCount), inline: true },
|
||||
@@ -48,9 +48,9 @@ async function giteaStatsEmbed() {
|
||||
const release = asList(releases)[0];
|
||||
|
||||
const embed = baseEmbed(COLORS.gitea)
|
||||
.setTitle('Activité Gitea')
|
||||
.setTitle('📈 Activité Gitea')
|
||||
.setURL(repositoryUrl())
|
||||
.setDescription(latestCommits || 'Aucun commit récent.')
|
||||
.setDescription(latestCommits || 'Aucun commit récent pour le moment.')
|
||||
.addFields(
|
||||
{ name: 'Issues ouvertes', value: String(asList(issues).length), inline: true },
|
||||
{ name: 'PR ouvertes', value: String(asList(pulls).length), inline: true },
|
||||
@@ -67,7 +67,7 @@ function fwsStatsEmbed(interaction) {
|
||||
const total = actions.reduce((sum, row) => sum + row.count, 0);
|
||||
|
||||
return baseEmbed(COLORS.gitea)
|
||||
.setTitle('Indicateurs FWS')
|
||||
.setTitle('📈 Indicateurs FWS')
|
||||
.addFields(
|
||||
{ name: 'Tickets ouverts', value: String(countOpenTickets(interaction.guildId)), inline: true },
|
||||
{ name: 'Sondages créés', value: String(countPolls(interaction.guildId)), inline: true },
|
||||
@@ -107,7 +107,9 @@ export async function execute(interaction) {
|
||||
log.error('Could not read Gitea stats', error);
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
errorEmbed('Les statistiques Gitea sont indisponibles. Vérifie `GITEA_URL` et `GITEA_TOKEN`.'),
|
||||
errorEmbed(
|
||||
'Les statistiques Gitea ne répondent pas. Réessaie dans un instant — si ça continue, l’équipe peut vérifier `GITEA_URL` et `GITEA_TOKEN`. Le reste du bot fonctionne normalement.',
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
+36
-16
@@ -24,8 +24,10 @@ export const data = new SlashCommandBuilder()
|
||||
.addSubcommand((sub) =>
|
||||
sub
|
||||
.setName('changelog')
|
||||
.setDescription("Changements d'une version")
|
||||
.addStringOption((option) => option.setName('version').setDescription('Version (dernière par défaut)')),
|
||||
.setDescription('Nouveautés d’une version')
|
||||
.addStringOption((option) =>
|
||||
option.setName('version').setDescription('Version souhaitée (la dernière par défaut)'),
|
||||
),
|
||||
);
|
||||
|
||||
const officialLinks = () => [
|
||||
@@ -62,7 +64,7 @@ async function showInfo(interaction) {
|
||||
const configured = readSetting(interaction.guildId, 'fws.info', DEFAULT_PRESENTATION);
|
||||
const description = typeof configured === 'string' && configured ? configured : DEFAULT_PRESENTATION;
|
||||
await interaction.reply({
|
||||
embeds: [baseEmbed().setTitle('FWS & FWS Arch').setDescription(description)],
|
||||
embeds: [baseEmbed().setTitle('🚀 FWS & FWS Arch').setDescription(description)],
|
||||
components: linkButtons(officialLinks()),
|
||||
});
|
||||
}
|
||||
@@ -73,8 +75,10 @@ async function showVersion(interaction) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
fallback
|
||||
? infoEmbed('Version FWS Arch', `Version publiée : **${fallback}**`)
|
||||
: errorEmbed('Gitea n’est pas configuré : impossible de lire la dernière version.'),
|
||||
? infoEmbed('📦 Version FWS Arch', `Dernière version publiée : **${fallback}**`)
|
||||
: errorEmbed(
|
||||
'La partie Gitea n’est pas encore configurée : je ne peux pas lire la dernière version. L’équipe peut la renseigner dans le `.env`.',
|
||||
),
|
||||
],
|
||||
});
|
||||
return;
|
||||
@@ -87,8 +91,8 @@ async function showVersion(interaction) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
fallback
|
||||
? infoEmbed('Version FWS Arch', `Version publiée : **${fallback}**`)
|
||||
: infoEmbed('Version FWS Arch', 'Aucune release publiée pour le moment.'),
|
||||
? infoEmbed('📦 Version FWS Arch', `Dernière version publiée : **${fallback}**`)
|
||||
: infoEmbed('📦 Version FWS Arch', 'Aucune release publiée pour le moment.'),
|
||||
],
|
||||
});
|
||||
return;
|
||||
@@ -123,15 +127,15 @@ async function showStatus(interaction) {
|
||||
|
||||
const uptime = Math.floor(process.uptime());
|
||||
const embed = baseEmbed(COLORS.info)
|
||||
.setTitle('État des services')
|
||||
.setTitle('🩺 État des services')
|
||||
.addFields(
|
||||
{
|
||||
name: 'API Gitea',
|
||||
value: !giteaConfigured
|
||||
? '⚙️ Non configurée'
|
||||
? '⚙️ Pas encore configurée'
|
||||
: giteaReachable
|
||||
? `✅ En ligne — ${repositoryUrl()}`
|
||||
: '❌ Injoignable',
|
||||
: '❌ Injoignable pour le moment',
|
||||
inline: false,
|
||||
},
|
||||
{
|
||||
@@ -142,7 +146,9 @@ async function showStatus(interaction) {
|
||||
{
|
||||
name: 'Base SQLite',
|
||||
value:
|
||||
openTickets === null ? '❌ Indisponible' : `✅ Accessible — ${openTickets} ticket(s) ouvert(s)`,
|
||||
openTickets === null
|
||||
? '❌ Indisponible pour le moment'
|
||||
: `✅ Accessible — ${openTickets} ticket(s) ouvert(s)`,
|
||||
inline: false,
|
||||
},
|
||||
{
|
||||
@@ -150,7 +156,7 @@ async function showStatus(interaction) {
|
||||
value: `✅ Connecté — ${Math.round(interaction.client.ws.ping)} ms`,
|
||||
inline: false,
|
||||
},
|
||||
{ name: 'Disponibilité du bot', value: `<t:${Math.floor((Date.now() - uptime * 1000) / 1000)}:R>` },
|
||||
{ name: 'En ligne depuis', value: `<t:${Math.floor((Date.now() - uptime * 1000) / 1000)}:R>` },
|
||||
);
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
@@ -160,7 +166,11 @@ async function showChangelog(interaction) {
|
||||
const version = interaction.options.getString('version');
|
||||
if (!isGiteaConfigured()) {
|
||||
await interaction.reply({
|
||||
embeds: [errorEmbed('Gitea n’est pas configuré : le changelog est indisponible.')],
|
||||
embeds: [
|
||||
errorEmbed(
|
||||
'La partie Gitea n’est pas encore configurée : le changelog arrivera dès qu’elle sera branchée.',
|
||||
),
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -170,7 +180,12 @@ async function showChangelog(interaction) {
|
||||
const release = version ? await gitea.getReleaseByTag(version) : await latestRelease();
|
||||
if (!release) {
|
||||
await interaction.editReply({
|
||||
embeds: [infoEmbed('Changelog', `Aucune release trouvée pour **${version}**.`)],
|
||||
embeds: [
|
||||
infoEmbed(
|
||||
'📜 Changelog',
|
||||
`Je ne trouve aucune release pour **${version}** : \`/gitea release\` liste les versions existantes.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -183,7 +198,12 @@ async function showChangelog(interaction) {
|
||||
if (version) {
|
||||
log.warn(`Release ${version} not found`, error);
|
||||
await interaction.editReply({
|
||||
embeds: [infoEmbed('Changelog', `La version **${version}** n’existe pas dans les releases Gitea.`)],
|
||||
embeds: [
|
||||
infoEmbed(
|
||||
'📜 Changelog',
|
||||
`Cette version **${version}** n’existe pas dans les releases Gitea : \`/gitea release\` liste celles qui existent.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -199,7 +219,7 @@ export async function execute(interaction) {
|
||||
return;
|
||||
case 'links':
|
||||
await interaction.reply({
|
||||
embeds: [baseEmbed().setTitle('Liens officiels FWS')],
|
||||
embeds: [baseEmbed().setTitle('🔗 Liens officiels FWS')],
|
||||
components: linkButtons(officialLinks()),
|
||||
});
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MessageFlags, SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS } from '../../config/constants.js';
|
||||
import { ACCESS_LABELS, ACCESS_LEVELS } from '../../config/constants.js';
|
||||
import { getAccessLevel } from '../../core/permissions.js';
|
||||
import { baseEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.USER;
|
||||
|
||||
@@ -16,6 +16,10 @@ export async function execute(interaction) {
|
||||
.map((command) => `\`/${command.data.name}\` — ${command.data.description}`)
|
||||
.sort();
|
||||
|
||||
const embed = baseEmbed().setTitle('Commandes FWS-Bot').setDescription(lines.join('\n'));
|
||||
const embed = baseEmbed()
|
||||
.setTitle('🤖 Tes commandes')
|
||||
.setDescription(
|
||||
`Tu es au niveau **${ACCESS_LABELS[level]}**. Voici ce que tu peux lancer :\n\n${bullets(lines)}`,
|
||||
);
|
||||
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
+12
-11
@@ -2,7 +2,7 @@ import { SlashCommandBuilder } from 'discord.js';
|
||||
import { ACCESS_LEVELS, COLORS } from '../../config/constants.js';
|
||||
import { asList, gitea, repositoryUrl } from '../../services/gitea/gitea-client.js';
|
||||
import { replyGiteaFailure, assertGiteaConfigured } from '../../services/gitea/gitea-modals.js';
|
||||
import { baseEmbed, successEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets, successEmbed } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.USER;
|
||||
|
||||
@@ -13,13 +13,14 @@ export const data = new SlashCommandBuilder()
|
||||
.addSubcommand((sub) => sub.setName('release').setDescription('Releases disponibles'));
|
||||
|
||||
const commitLines = (commits) =>
|
||||
asList(commits)
|
||||
.slice(0, 5)
|
||||
.map((commit) => {
|
||||
const message = commit.commit?.message?.split('\n')[0] ?? '(sans message)';
|
||||
return `\`${commit.sha?.slice(0, 7)}\` ${message} — *${commit.commit?.author?.name ?? 'inconnu'}*`;
|
||||
})
|
||||
.join('\n');
|
||||
bullets(
|
||||
asList(commits)
|
||||
.slice(0, 5)
|
||||
.map((commit) => {
|
||||
const message = commit.commit?.message?.split('\n')[0] ?? '(sans message)';
|
||||
return `\`${commit.sha?.slice(0, 7)}\` ${message} — *${commit.commit?.author?.name ?? 'un compte inconnu'}*`;
|
||||
}),
|
||||
);
|
||||
|
||||
/** Read-only summaries of the repository (M5-T06 / M5-T07). */
|
||||
export async function execute(interaction) {
|
||||
@@ -35,7 +36,7 @@ export async function execute(interaction) {
|
||||
}
|
||||
|
||||
const embed = baseEmbed(COLORS.gitea)
|
||||
.setTitle('Releases FWS Arch')
|
||||
.setTitle('📦 Releases FWS Arch')
|
||||
.setURL(repositoryUrl())
|
||||
.setDescription(
|
||||
releases
|
||||
@@ -59,9 +60,9 @@ export async function execute(interaction) {
|
||||
]);
|
||||
|
||||
const embed = baseEmbed(COLORS.gitea)
|
||||
.setTitle('Activité récente')
|
||||
.setTitle('📈 Activité récente')
|
||||
.setURL(repositoryUrl())
|
||||
.setDescription(commitLines(commits) || 'Aucun commit récent.')
|
||||
.setDescription(commitLines(commits) || 'Aucun commit récent pour le moment.')
|
||||
.addFields(
|
||||
{ name: 'Issues ouvertes', value: String(asList(issues).length), inline: true },
|
||||
{ name: 'PR ouvertes', value: String(asList(pulls).length), inline: true },
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
openIssueModal,
|
||||
replyGiteaFailure,
|
||||
} from '../../services/gitea/gitea-modals.js';
|
||||
import { baseEmbed, successEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets, successEmbed } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.USER;
|
||||
|
||||
@@ -24,7 +24,7 @@ export const data = new SlashCommandBuilder()
|
||||
.setName('view')
|
||||
.setDescription('Afficher une issue')
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('number').setDescription("Numéro de l'issue").setRequired(true).setMinValue(1),
|
||||
option.setName('number').setDescription('Numéro de l’issue').setRequired(true).setMinValue(1),
|
||||
),
|
||||
)
|
||||
.addSubcommand((sub) => sub.setName('list').setDescription('Lister les issues ouvertes'));
|
||||
@@ -44,24 +44,33 @@ export async function execute(interaction) {
|
||||
try {
|
||||
if (subcommand === 'view') {
|
||||
const issue = await gitea.getIssue(interaction.options.getInteger('number', true));
|
||||
if (!issue?.number) throw new UserFacingError('Cette issue est introuvable sur Gitea.');
|
||||
if (!issue?.number) {
|
||||
throw new UserFacingError(
|
||||
'Je ne trouve pas cette issue sur Gitea : vérifie son numéro avec `/issue list`.',
|
||||
);
|
||||
}
|
||||
await interaction.editReply({ embeds: [issueEmbed(issue)] });
|
||||
return;
|
||||
}
|
||||
|
||||
const issues = asList(await gitea.listIssues('state=open&type=issues&limit=15'));
|
||||
if (issues.length === 0) {
|
||||
await interaction.editReply({ embeds: [successEmbed('Aucune issue ouverte. 🎉')] });
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed('Aucune issue ouverte : rien en attente, tout est traité 🎉')],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = baseEmbed(COLORS.gitea)
|
||||
.setTitle('Issues ouvertes')
|
||||
.setTitle('🐙 Issues ouvertes')
|
||||
.setURL(`${repositoryUrl()}/issues`)
|
||||
.setDescription(
|
||||
issues
|
||||
.map((issue) => `**#${issue.number}** ${issue.title} — *${issue.user?.login ?? 'inconnu'}*`)
|
||||
.join('\n'),
|
||||
bullets(
|
||||
issues.map(
|
||||
(issue) =>
|
||||
`**#${issue.number}** ${issue.title} — ouverte par *${issue.user?.login ?? 'un compte inconnu'}*`,
|
||||
),
|
||||
),
|
||||
)
|
||||
.setFooter({ text: `${issues.length} issue(s) affichée(s)` });
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
|
||||
+27
-11
@@ -8,7 +8,7 @@ import {
|
||||
openPullRequestModal,
|
||||
replyGiteaFailure,
|
||||
} from '../../services/gitea/gitea-modals.js';
|
||||
import { baseEmbed, successEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets, successEmbed } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.USER;
|
||||
export const subcommandAccess = { create: ACCESS_LEVELS.DEV };
|
||||
@@ -20,8 +20,18 @@ export const data = new SlashCommandBuilder()
|
||||
sub
|
||||
.setName('create')
|
||||
.setDescription('Créer une pull request')
|
||||
.addStringOption((option) => option.setName('head').setDescription('Branche source').setRequired(true))
|
||||
.addStringOption((option) => option.setName('base').setDescription('Branche cible').setRequired(true)),
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('head')
|
||||
.setDescription('Branche source, celle qui apporte les changements')
|
||||
.setRequired(true),
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('base')
|
||||
.setDescription('Branche cible, celle qui reçoit les changements')
|
||||
.setRequired(true),
|
||||
),
|
||||
)
|
||||
.addSubcommand((sub) =>
|
||||
sub
|
||||
@@ -48,28 +58,34 @@ export async function execute(interaction) {
|
||||
try {
|
||||
if (subcommand === 'view') {
|
||||
const pull = await gitea.getPullRequest(interaction.options.getInteger('number', true));
|
||||
if (!pull?.number) throw new UserFacingError('Cette pull request est introuvable sur Gitea.');
|
||||
if (!pull?.number) {
|
||||
throw new UserFacingError(
|
||||
'Je ne trouve pas cette pull request sur Gitea : vérifie son numéro avec `/pr list`.',
|
||||
);
|
||||
}
|
||||
await interaction.editReply({ embeds: [pullRequestEmbed(pull)] });
|
||||
return;
|
||||
}
|
||||
|
||||
const pulls = asList(await gitea.listPullRequests('state=open&limit=15'));
|
||||
if (pulls.length === 0) {
|
||||
await interaction.editReply({ embeds: [successEmbed('Aucune pull request ouverte.')] });
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed('Aucune pull request ouverte : rien à relire pour le moment 🎉')],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = baseEmbed(COLORS.gitea)
|
||||
.setTitle('Pull requests ouvertes')
|
||||
.setTitle('🐙 Pull requests ouvertes')
|
||||
.setURL(`${repositoryUrl()}/pulls`)
|
||||
.setDescription(
|
||||
pulls
|
||||
.map(
|
||||
bullets(
|
||||
pulls.map(
|
||||
(pull) =>
|
||||
`**#${pull.number}** ${pull.title} — ${pull.head?.ref ?? '?'} → ${pull.base?.ref ?? '?'} ` +
|
||||
`(*${pull.user?.login ?? 'inconnu'}*)`,
|
||||
)
|
||||
.join('\n'),
|
||||
`(proposée par *${pull.user?.login ?? 'un compte inconnu'}*)`,
|
||||
),
|
||||
),
|
||||
)
|
||||
.setFooter({ text: `${pulls.length} PR affichée(s)` });
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
|
||||
@@ -14,11 +14,11 @@ export const data = new SlashCommandBuilder()
|
||||
.setDescription('Bannir un membre')
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
|
||||
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500))
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500))
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('delete_days')
|
||||
.setDescription('Supprimer les messages des N derniers jours')
|
||||
.setDescription('Supprimer aussi les messages des N derniers jours (0 à 7)')
|
||||
.setMinValue(0)
|
||||
.setMaxValue(7),
|
||||
);
|
||||
@@ -41,12 +41,16 @@ export async function execute(interaction) {
|
||||
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
await interaction.guild.bans.create(user.id, {
|
||||
reason: reason ?? `Banni par ${interaction.user.tag}`,
|
||||
reason: reason ?? `Bannissement demandé par ${interaction.user.tag}`,
|
||||
deleteMessageSeconds: deleteDays * 86_400,
|
||||
});
|
||||
|
||||
await logModerationAction(interaction, { action: 'ban', targetId: user.id, reason });
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed(`**${user.tag}** a été banni du serveur.`)],
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`C’est fait : **${user.tag}** ne peut plus revenir sur le serveur. L’historique reste consultable avec \`/mod logs\`.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export const data = new SlashCommandBuilder()
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('amount')
|
||||
.setDescription('Nombre de messages')
|
||||
.setDescription('Nombre de messages à supprimer (1 à 100)')
|
||||
.setRequired(true)
|
||||
.setMinValue(1)
|
||||
.setMaxValue(100),
|
||||
@@ -23,7 +23,9 @@ export const data = new SlashCommandBuilder()
|
||||
export async function execute(interaction) {
|
||||
const amount = interaction.options.getInteger('amount', true);
|
||||
if (!interaction.channel?.isTextBased() || !interaction.channel.bulkDelete) {
|
||||
throw new UserFacingError('La suppression groupée n’est pas possible dans ce salon.');
|
||||
throw new UserFacingError(
|
||||
'Je ne peux pas supprimer plusieurs messages d’un coup ici : lance la commande dans un salon textuel.',
|
||||
);
|
||||
}
|
||||
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
@@ -37,8 +39,10 @@ export async function execute(interaction) {
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`${deleted.size} message(s) supprimé(s) dans <#${interaction.channelId}>.` +
|
||||
(deleted.size < amount ? '\n_Les messages de plus de 14 jours sont conservés par Discord._' : ''),
|
||||
`C’est nettoyé : ${deleted.size} message(s) supprimé(s) dans <#${interaction.channelId}>.` +
|
||||
(deleted.size < amount
|
||||
? '\n_Discord conserve les messages de plus de 14 jours : ils n’ont pas pu être retirés._'
|
||||
: ''),
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ export const data = new SlashCommandBuilder()
|
||||
.setDescription('Expulser un membre du serveur')
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers)
|
||||
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500));
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500));
|
||||
|
||||
/** Expels the member after the hierarchy checks (M8-T03 / M8-T06). */
|
||||
export async function execute(interaction) {
|
||||
@@ -31,10 +31,14 @@ export async function execute(interaction) {
|
||||
embeds: [targetNoticeEmbed({ action: 'kick', guildName: interaction.guild.name, reason })],
|
||||
})
|
||||
.catch(() => {});
|
||||
await target.kick(reason ?? `Expulsé par ${interaction.user.tag}`);
|
||||
await target.kick(reason ?? `Expulsion demandée par ${interaction.user.tag}`);
|
||||
|
||||
await logModerationAction(interaction, { action: 'kick', targetId: target.id, reason });
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed(`**${target.user.tag}** a été expulsé du serveur.`)],
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`C’est fait : **${target.user.tag}** ne fait plus partie du serveur. La personne peut revenir avec une nouvelle invitation.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -25,7 +25,7 @@ function formatEntry(row) {
|
||||
const duration = row.duration_ms ? ` pendant ${formatDuration(row.duration_ms)}` : '';
|
||||
return (
|
||||
`\`${row.created_at}\` **${meta?.label ?? row.action}** — ${target}${duration}\n` +
|
||||
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans raison'}`
|
||||
`↳ par <@${row.moderator_id}> · ${row.reason || 'sans motif'}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,13 +41,15 @@ export async function execute(interaction) {
|
||||
const embed =
|
||||
actions.length === 0
|
||||
? infoEmbed(
|
||||
'Historique de modération',
|
||||
user ? `Aucune action enregistrée contre ${user}.` : 'Aucune action enregistrée sur ce serveur.',
|
||||
'📜 Historique de modération',
|
||||
user
|
||||
? `Rien à signaler concernant ${user} : aucune action de modération enregistrée.`
|
||||
: 'Aucune action de modération enregistrée sur ce serveur, tout est calme.',
|
||||
)
|
||||
: baseEmbed(COLORS.moderation)
|
||||
.setTitle(user ? `Historique de ${user.tag}` : 'Dernières actions de modération')
|
||||
.setTitle(user ? `📜 Historique de ${user.tag}` : '📜 Dernières actions de modération')
|
||||
.setDescription(actions.map(formatEntry).join('\n\n'))
|
||||
.setFooter({ text: `${actions.length} dernière(s) action(s)` });
|
||||
.setFooter({ text: `${actions.length} action(s) affichée(s)` });
|
||||
|
||||
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
@@ -19,12 +19,12 @@ export const data = new SlashCommandBuilder()
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('minutes')
|
||||
.setDescription('Durée en minutes')
|
||||
.setDescription('Durée de la sanction, en minutes')
|
||||
.setRequired(true)
|
||||
.setMinValue(1)
|
||||
.setMaxValue(40_320),
|
||||
)
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500));
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500));
|
||||
|
||||
/** Applies a Discord timeout after the hierarchy checks (M8-T02 / M8-T07). */
|
||||
export async function execute(interaction) {
|
||||
@@ -53,7 +53,9 @@ export async function execute(interaction) {
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
successEmbed(`**${target.user.tag}** est réduit au silence pendant **${formatDuration(durationMs)}**.`),
|
||||
successEmbed(
|
||||
`C’est fait : **${target.user.tag}** est en exclusion temporaire pour **${formatDuration(durationMs)}**, la personne ne peut plus écrire pendant ce temps.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
removeNotificationChannel,
|
||||
setNotificationChannel,
|
||||
} from '../../database/repositories/notification-repository.js';
|
||||
import { baseEmbed, successEmbed } from '../../ui/embeds.js';
|
||||
import { baseEmbed, bullets, successEmbed } from '../../ui/embeds.js';
|
||||
|
||||
export const access = ACCESS_LEVELS.STAFF;
|
||||
|
||||
@@ -58,7 +58,9 @@ export async function execute(interaction) {
|
||||
const channel = interaction.options.getChannel('channel', true);
|
||||
setNotificationChannel({ guildId: interaction.guildId, type, channelId: channel.id });
|
||||
await interaction.reply({
|
||||
embeds: [successEmbed(`Les notifications **${type}** seront envoyées dans <#${channel.id}>.`)],
|
||||
embeds: [
|
||||
successEmbed(`C’est noté : les notifications **${type}** partent maintenant dans <#${channel.id}>.`),
|
||||
],
|
||||
flags: MessageFlags.Ephemeral,
|
||||
});
|
||||
return;
|
||||
@@ -67,9 +69,15 @@ export async function execute(interaction) {
|
||||
if (subcommand === 'remove') {
|
||||
const type = interaction.options.getString('type', true);
|
||||
const removed = removeNotificationChannel(interaction.guildId, type);
|
||||
if (!removed) throw new UserFacingError(`Aucun salon personnalisé n’est configuré pour **${type}**.`);
|
||||
if (!removed) {
|
||||
throw new UserFacingError(
|
||||
`Le type **${type}** utilise déjà la configuration par défaut : il n’y a rien à retirer.`,
|
||||
);
|
||||
}
|
||||
await interaction.reply({
|
||||
embeds: [successEmbed(`Les notifications **${type}** repassent à la configuration par défaut.`)],
|
||||
embeds: [
|
||||
successEmbed(`C’est fait : les notifications **${type}** repassent à la configuration par défaut.`),
|
||||
],
|
||||
flags: MessageFlags.Ephemeral,
|
||||
});
|
||||
return;
|
||||
@@ -81,15 +89,15 @@ export async function execute(interaction) {
|
||||
const lines = NOTIFICATION_TYPES.map((type) => {
|
||||
const channelId = overrides.get(type);
|
||||
return channelId
|
||||
? `\`${type}\` → <#${channelId}> _(personnalisé)_`
|
||||
? `\`${type}\` → <#${channelId}> _(choisi sur ce serveur)_`
|
||||
: `\`${type}\` → _configuration par défaut_`;
|
||||
});
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
baseEmbed()
|
||||
.setTitle('Salons de notification')
|
||||
.setDescription(lines.join('\n'))
|
||||
.setTitle('🔔 Salons de notification')
|
||||
.setDescription(`${bullets(lines)}\n\nPour changer une destination : \`/notify set\`.`)
|
||||
.setFooter({ text: `Serveur ${interaction.guildId}` }),
|
||||
],
|
||||
flags: MessageFlags.Ephemeral,
|
||||
|
||||
@@ -19,9 +19,12 @@ export const data = new SlashCommandBuilder()
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('action')
|
||||
.setDescription('Action')
|
||||
.setDescription('Ajouter ou retirer le rôle')
|
||||
.setRequired(true)
|
||||
.addChoices({ name: 'Ajouter', value: 'add' }, { name: 'Retirer', value: 'remove' }),
|
||||
.addChoices(
|
||||
{ name: 'Ajouter le rôle', value: 'add' },
|
||||
{ name: 'Retirer le rôle', value: 'remove' },
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -33,26 +36,37 @@ export async function execute(interaction) {
|
||||
const adding = action === 'add';
|
||||
|
||||
if (role.id === interaction.guild.roles.everyone.id) {
|
||||
throw new UserFacingError('Le rôle @everyone ne peut pas être attribué.');
|
||||
throw new UserFacingError(
|
||||
'Le rôle @everyone ne s’attribue pas : il est porté par tout le monde à la fois.',
|
||||
);
|
||||
}
|
||||
if (role.managed) {
|
||||
throw new UserFacingError('Ce rôle est géré par une intégration et ne peut pas être modifié.');
|
||||
throw new UserFacingError(
|
||||
'Ce rôle appartient à une intégration : Discord le gère tout seul, je ne peux pas le modifier.',
|
||||
);
|
||||
}
|
||||
|
||||
const bot = interaction.guild.members.me;
|
||||
if (bot && bot.roles.highest.comparePositionTo(role) <= 0) {
|
||||
throw new UserFacingError('Mon rôle est trop bas pour gérer ce rôle.');
|
||||
throw new UserFacingError(
|
||||
'Je ne peux pas gérer ce rôle : il est placé plus haut que le mien. Remonte mon rôle dans la hiérarchie du serveur, et je m’en occupe.',
|
||||
);
|
||||
}
|
||||
|
||||
const target = await fetchTargetMember(interaction, user.id);
|
||||
const hasRole = target.roles.cache.has(role.id);
|
||||
if (adding && hasRole) throw new UserFacingError(`**${target.user.tag}** possède déjà le rôle ${role}.`);
|
||||
if (!adding && !hasRole)
|
||||
throw new UserFacingError(`**${target.user.tag}** ne possède pas le rôle ${role}.`);
|
||||
if (adding && hasRole) {
|
||||
throw new UserFacingError(`Rien à faire : **${target.user.tag}** porte déjà le rôle ${role}.`);
|
||||
}
|
||||
if (!adding && !hasRole) {
|
||||
throw new UserFacingError(`Rien à retirer : **${target.user.tag}** n’a pas le rôle ${role}.`);
|
||||
}
|
||||
|
||||
const isGuildOwner = interaction.guild.ownerId === interaction.user.id;
|
||||
if (!isGuildOwner && interaction.member.roles.highest.comparePositionTo(role) <= 0) {
|
||||
throw new UserFacingError('Tu ne peux pas gérer un rôle au-dessus ou égal au tien.');
|
||||
throw new UserFacingError(
|
||||
'Ce rôle est au même niveau (ou plus haut) que le tien : je ne peux pas y toucher. Demande à quelqu’un de plus haut dans la hiérarchie.',
|
||||
);
|
||||
}
|
||||
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
@@ -69,7 +83,9 @@ export async function execute(interaction) {
|
||||
});
|
||||
await interaction.editReply({
|
||||
embeds: [
|
||||
successEmbed(`Le rôle ${role} a été ${adding ? 'ajouté à' : 'retiré de'} **${target.user.tag}**.`),
|
||||
successEmbed(
|
||||
`C’est fait : le rôle ${role} a été ${adding ? 'ajouté à' : 'retiré de'} **${target.user.tag}**.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export const data = new SlashCommandBuilder()
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers)
|
||||
.addUserOption((option) => option.setName('user').setDescription('Membre').setRequired(true))
|
||||
.addStringOption((option) =>
|
||||
option.setName('reason').setDescription('Raison').setRequired(true).setMaxLength(500),
|
||||
option.setName('reason').setDescription('Motif').setRequired(true).setMaxLength(500),
|
||||
);
|
||||
|
||||
/** Records the warning, notifies the member and logs it (M8-T01 / M8-T06). */
|
||||
@@ -44,6 +44,10 @@ export async function execute(interaction) {
|
||||
.catch(() => {});
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed(`**${target.user.tag}** a été averti (${total} avertissement(s) au total).`)],
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`C’est fait : **${target.user.tag}** reçoit un avertissement (${total} au total). La personne a aussi reçu un message privé quand c’était possible.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export const data = new SlashCommandBuilder()
|
||||
sub
|
||||
.setName('close')
|
||||
.setDescription('Fermer le ticket')
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Raison').setMaxLength(500)),
|
||||
.addStringOption((option) => option.setName('reason').setDescription('Motif').setMaxLength(500)),
|
||||
)
|
||||
.addSubcommand((sub) => sub.setName('claim').setDescription('Prendre le ticket en charge'))
|
||||
.addSubcommand((sub) =>
|
||||
@@ -49,7 +49,11 @@ export async function execute(interaction) {
|
||||
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
|
||||
const channel = await createTicket(interaction, categoryId);
|
||||
await interaction.editReply({
|
||||
embeds: [successEmbed(`Ton ticket est ouvert : <#${channel.id}>`)],
|
||||
embeds: [
|
||||
successEmbed(
|
||||
`Ton ticket est ouvert : <#${channel.id}>. Décris ta demande dedans, une personne de l’équipe te répond dès que possible.`,
|
||||
),
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user