Add link to original case in case log channel to case embed
This commit is contained in:
parent
eb203a3b7a
commit
1778f95453
2 changed files with 13 additions and 0 deletions
|
@ -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<CasesPluginType>,
|
||||
|
@ -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 };
|
||||
}
|
||||
|
|
3
backend/src/utils/buildMessageLink.ts
Normal file
3
backend/src/utils/buildMessageLink.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function buildMessageLink(guildId: string, channelId: string, messageId: string) {
|
||||
return `https://discord.com/channels/${guildId}/${channelId}/${messageId}`;
|
||||
}
|
Loading…
Add table
Reference in a new issue