diff --git a/backend/src/plugins/Cases/functions/getCaseEmbed.ts b/backend/src/plugins/Cases/functions/getCaseEmbed.ts index 5ca82300..c40557b2 100644 --- a/backend/src/plugins/Cases/functions/getCaseEmbed.ts +++ b/backend/src/plugins/Cases/functions/getCaseEmbed.ts @@ -9,6 +9,7 @@ import { resolveCaseId } from "./resolveCaseId"; import { chunkLines, chunkMessageLines, emptyEmbedValue } from "../../../utils"; import { inGuildTz } from "../../../utils/timezones"; import { getDateFormat } from "../../../utils/dateFormats"; +import { buildMessageLink } from "../../../utils/buildMessageLink"; export async function getCaseEmbed( pluginData: PluginData, @@ -89,5 +90,14 @@ export async function getCaseEmbed( }); } + if (theCase.log_message_id) { + const [channelId, messageId] = theCase.log_message_id.split("-"); + const link = buildMessageLink(pluginData.guild.id, channelId, messageId); + embed.fields.push({ + name: emptyEmbedValue, + value: `[Go to original case in case log channel](${link})`, + }); + } + return { embed }; } diff --git a/backend/src/utils/buildMessageLink.ts b/backend/src/utils/buildMessageLink.ts new file mode 100644 index 00000000..6beae14e --- /dev/null +++ b/backend/src/utils/buildMessageLink.ts @@ -0,0 +1,3 @@ +export function buildMessageLink(guildId: string, channelId: string, messageId: string) { + return `https://discord.com/channels/${guildId}/${channelId}/${messageId}`; +}