Add link to original case in case log channel to case embed

This commit is contained in:
Dragory 2020-08-10 03:22:57 +03:00
parent eb203a3b7a
commit 1778f95453
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 13 additions and 0 deletions

View file

@ -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 };
}

View file

@ -0,0 +1,3 @@
export function buildMessageLink(guildId: string, channelId: string, messageId: string) {
return `https://discord.com/channels/${guildId}/${channelId}/${messageId}`;
}