3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25: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

@ -3,7 +3,7 @@ import { UtilityPluginType } from "../types";
import { Constants, EmbedOptions } from "eris";
import moment from "moment-timezone";
import humanizeDuration from "humanize-duration";
import { chunkMessageLines, preEmbedPadding, trimEmptyLines, trimLines } from "../../../utils";
import { chunkMessageLines, messageLink, preEmbedPadding, trimEmptyLines, trimLines } from "../../../utils";
import { getDefaultPrefix } from "knub/dist/commands/commandUtils";
import { inGuildTz } from "../../../utils/timezones";
import { getDateFormat } from "../../../utils/dateFormats";
@ -69,9 +69,7 @@ export async function getMessageInfoEmbed(
Created: **${messageAge} ago** (\`${prettyCreatedAt}\`)
${editedAt ? `Edited at: **${editAge} ago** (\`${prettyEditedAt}\`)` : ""}
Type: **${type}**
Link: [**Go to message **](https://discord.com/channels/${pluginData.guild.id}/${message.channel.id}/${
message.id
})
Link: [**Go to message **](${messageLink(pluginData.guild.id, message.channel.id, message.id)})
`),
),
});

View file

@ -1,7 +1,16 @@
import { Message, GuildTextableChannel, EmbedOptions } from "eris";
import { PluginData } from "knub";
import { UtilityPluginType } from "../types";
import { UnknownUser, trimLines, embedPadding, resolveMember, resolveUser, preEmbedPadding, sorter } from "src/utils";
import {
UnknownUser,
trimLines,
embedPadding,
resolveMember,
resolveUser,
preEmbedPadding,
sorter,
messageLink,
} from "src/utils";
import moment from "moment-timezone";
import { CaseTypes } from "src/data/CaseTypes";
import humanizeDuration from "humanize-duration";
@ -123,7 +132,7 @@ export async function getUserInfoEmbed(
if (c.log_message_id) {
const [channelId, messageId] = c.log_message_id.split("-");
return `[${summaryText}](https://discord.com/channels/${pluginData.guild.id}/${channelId}/${messageId})`;
return `[${summaryText}](${messageLink(pluginData.guild.id, channelId, messageId)})`;
}
return summaryText;