diff --git a/src/modules/quoiFeur/quoiFeur.helpers.ts b/src/modules/quoiFeur/quoiFeur.helpers.ts index e806fc6..60501e1 100644 --- a/src/modules/quoiFeur/quoiFeur.helpers.ts +++ b/src/modules/quoiFeur/quoiFeur.helpers.ts @@ -52,12 +52,15 @@ export const addQuoiFeurToChannel = async (interaction: ChatInputCommandInteract const channels = await cache.get('quoiFeurChannels', []); if (channels.includes(channel.id)) { - await interaction.reply('Quoi-feur is already enabled in this channel'); + await interaction.reply({ + content: 'Quoi-feur is already enabled in this channel', + ephemeral: true, + }); return; } await cache.set('quoiFeurChannels', [...channels, channel.id]); - await interaction.reply('Quoi-feur enabled in this channel'); + await interaction.reply({ content: 'Quoi-feur enabled in this channel', ephemeral: true }); }; export const removeQuoiFeurFromChannel = async (interaction: ChatInputCommandInteraction) => { @@ -66,7 +69,10 @@ export const removeQuoiFeurFromChannel = async (interaction: ChatInputCommandInt const channels = await cache.get('quoiFeurChannels', []); if (!channels.includes(channel.id)) { - await interaction.reply('Quoi-feur is not enabled in this channel'); + await interaction.reply({ + content: 'Quoi-feur is not enabled in this channel', + ephemeral: true, + }); return; } @@ -74,7 +80,7 @@ export const removeQuoiFeurFromChannel = async (interaction: ChatInputCommandInt 'quoiFeurChannels', channels.filter((channelId) => channelId !== channel.id), ); - await interaction.reply('Quoi-feur disabled in this channel'); + await interaction.reply({ content: 'Quoi-feur disabled in this channel', ephemeral: true }); }; export const cleanCacheOnChannelDelete = async ( diff --git a/src/modules/quoiFeur/quoiFeur.module.ts b/src/modules/quoiFeur/quoiFeur.module.ts index c0f2ae8..d42d90b 100644 --- a/src/modules/quoiFeur/quoiFeur.module.ts +++ b/src/modules/quoiFeur/quoiFeur.module.ts @@ -15,10 +15,10 @@ export const quoiFeur: BotModule = { .setName('quoi-feur') .setDescription('Manage quoi-feur game in the channel') .addSubcommand((subcommand) => - subcommand.setName('add').setDescription('Add the quoi-feur game to the channel'), + subcommand.setName('enable').setDescription('Enable the quoi-feur game in the channel'), ) .addSubcommand((subcommand) => - subcommand.setName('remove').setDescription('Remove the quoi-feur game from the channel'), + subcommand.setName('disable').setDescription('Disable the quoi-feur game in the channel'), ) .toJSON(), handler: { diff --git a/src/modules/recurringMessage/recurringMessage.helpers.ts b/src/modules/recurringMessage/recurringMessage.helpers.ts index 5844f17..89ff4a6 100644 --- a/src/modules/recurringMessage/recurringMessage.helpers.ts +++ b/src/modules/recurringMessage/recurringMessage.helpers.ts @@ -34,7 +34,7 @@ export const isFrequency = (frequency: string): frequency is Frequency => { export const hasPermission = (interaction: ChatInputCommandInteraction) => { if (!isModo(interaction.member)) { - void interaction.reply('You are not allowed to use this command'); + void interaction.reply({ content: 'You are not allowed to use this command', ephemeral: true }); return false; } return true; @@ -67,22 +67,20 @@ export const addRecurringMessage = async (interaction: ChatInputCommandInteracti const channelId = interaction.channelId; const frequency = interaction.options.getString('frequency', true); if (!isFrequency(frequency)) { - await interaction.reply(`${frequency} is not a valid frequency`); + await interaction.reply({ content: `${frequency} is not a valid frequency`, ephemeral: true }); return; } const message = interaction.options.getString('message', true); - const displayIdInMessage = `\n (id: ${jobId})`; - const jobMessage = message + displayIdInMessage; - - if (jobMessage.length > MAX_MESSAGE_LENGTH) { - await interaction.reply( - `Message is too long (max ${MAX_MESSAGE_LENGTH - displayIdInMessage.length} characters)`, - ); + if (message.length > MAX_MESSAGE_LENGTH) { + await interaction.reply({ + content: `Message is too long (max ${MAX_MESSAGE_LENGTH} characters)`, + ephemeral: true, + }); return; } - const job = createRecurringMessage(interaction.client, channelId, frequency, jobMessage); + const job = createRecurringMessage(interaction.client, channelId, frequency, message); job.start(); inMemoryJobList.push({ id: jobId, job }); @@ -93,7 +91,10 @@ export const addRecurringMessage = async (interaction: ChatInputCommandInteracti { id: jobId, channelId, frequency, message }, ]); - await interaction.reply(`Recurring message added ${frequencyDisplay[frequency]}`); + await interaction.reply({ + content: `Recurring message added ${frequencyDisplay[frequency]}`, + ephemeral: true, + }); }; export const removeRecurringMessage = async (interaction: ChatInputCommandInteraction) => { @@ -107,20 +108,20 @@ export const removeRecurringMessage = async (interaction: ChatInputCommandIntera const job = inMemoryJobList.find(({ id }) => id === jobId)?.job; if (!job) { - await interaction.reply('Recurring message not found'); + await interaction.reply({ content: 'Recurring message not found', ephemeral: true }); return; } job.stop(); - await interaction.reply('Recurring message removed'); + await interaction.reply({ content: 'Recurring message removed', ephemeral: true }); }; export const listRecurringMessages = async (interaction: ChatInputCommandInteraction) => { const recurringMessages = await cache.get('recurringMessages', []); if (recurringMessages.length === 0) { - await interaction.reply('No recurring message found'); + await interaction.reply({ content: 'No recurring message found', ephemeral: true }); return; } @@ -159,7 +160,7 @@ export const listRecurringMessages = async (interaction: ChatInputCommandInterac }; }); - await interaction.reply({ embeds }); + await interaction.reply({ embeds, ephemeral: true }); }; export const relaunchRecurringMessages = async (client: Client) => {