diff --git a/packages/discord-bot/src/utils/embeds/praiseSuccessEmbed.ts b/packages/discord-bot/src/utils/embeds/praiseSuccessEmbed.ts index 298ceed7f..ef34e70dc 100644 --- a/packages/discord-bot/src/utils/embeds/praiseSuccessEmbed.ts +++ b/packages/discord-bot/src/utils/embeds/praiseSuccessEmbed.ts @@ -5,11 +5,17 @@ export const praiseSuccessEmbed = async ( user: User, receivers: string[], reason: string, - host: string + host: string, + praiseNotificationsEnabled = true ): Promise => { - const msg = ((await getSetting('PRAISE_SUCCESS_MESSAGE', host)) as string) - .replace('{@receivers}', `${receivers.join(', ')}`) - .replace('{reason}', reason); + let msg = (await getSetting('PRAISE_SUCCESS_MESSAGE', host)) as string; + + if (!praiseNotificationsEnabled) { + msg = msg.replace('{@receivers}', '[HIDDEN]'); + } else { + msg = msg.replace('{@receivers}', `${receivers.join(', ')}`); + } + msg = msg.replace('{reason}', reason); const embed = new EmbedBuilder().setColor(0xe6007e).setDescription(msg); return embed; diff --git a/packages/discord-bot/src/utils/givePraise.ts b/packages/discord-bot/src/utils/givePraise.ts index 98a951715..a900af912 100644 --- a/packages/discord-bot/src/utils/givePraise.ts +++ b/packages/discord-bot/src/utils/givePraise.ts @@ -69,6 +69,11 @@ export const givePraise = async ( }) ); + const praiseNotificationsEnabled = (await getSetting( + 'DISCORD_BOT_PRAISE_NOTIFICATIONS_ENABLED', + host + )) as boolean; + let praiseItems: Praise[] = []; if (receivers.length !== 0) { await interaction.editReply({ @@ -78,7 +83,8 @@ export const givePraise = async ( interaction.user, validReceiverIds.map((id) => `<@!${id}>`), reason, - host + host, + praiseNotificationsEnabled ), ], components: [], @@ -105,11 +111,6 @@ export const givePraise = async ( ? process.env?.FRONTEND_URL || 'undefined:/' : `https://${host}`; - const praiseNotificationsEnabled = (await getSetting( - 'DISCORD_BOT_PRAISE_NOTIFICATIONS_ENABLED', - host - )) as boolean; - if (praiseNotificationsEnabled) { await Promise.all( praiseItems.map(async (praise) => {