3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-20 00:05:04 +00:00

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 c5bb652a4c
commit 1123e87158
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}`;
}