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

Use messageLink() function for message links everywhere

This commit is contained in:
Dragory 2020-08-10 03:26:39 +03:00
parent 1778f95453
commit b379bea9b8
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
6 changed files with 19 additions and 17 deletions

View file

@ -6,10 +6,9 @@ import { PluginData, helpers } from "knub";
import { CasesPluginType } from "../types";
import { CaseTypeColors } from "../../../data/CaseTypeColors";
import { resolveCaseId } from "./resolveCaseId";
import { chunkLines, chunkMessageLines, emptyEmbedValue } from "../../../utils";
import { chunkLines, chunkMessageLines, emptyEmbedValue, messageLink } from "../../../utils";
import { inGuildTz } from "../../../utils/timezones";
import { getDateFormat } from "../../../utils/dateFormats";
import { buildMessageLink } from "../../../utils/buildMessageLink";
export async function getCaseEmbed(
pluginData: PluginData<CasesPluginType>,
@ -92,7 +91,7 @@ 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);
const link = messageLink(pluginData.guild.id, channelId, messageId);
embed.fields.push({
name: emptyEmbedValue,
value: `[Go to original case in case log channel](${link})`,

View file

@ -1,6 +1,6 @@
import { PluginData } from "knub";
import { CasesPluginType } from "../types";
import { disableLinkPreviews } from "../../../utils";
import { disableLinkPreviews, messageLink } from "../../../utils";
import { DBDateFormat, getDateFormat } from "../../../utils/dateFormats";
import { CaseTypes } from "../../../data/CaseTypes";
import moment from "moment-timezone";
@ -37,7 +37,7 @@ export async function getCaseSummary(
let caseTitle = `\`Case #${theCase.case_number}\``;
if (withLinks && theCase.log_message_id) {
const [channelId, messageId] = theCase.log_message_id.split("-");
caseTitle = `[${caseTitle}](https://discord.com/channels/${pluginData.guild.id}/${channelId}/${messageId})`;
caseTitle = `[${caseTitle}](${messageLink(pluginData.guild.id, channelId, messageId)})`;
} else {
caseTitle = `\`${caseTitle}\``;
}