feat: Add channel & message URL formatters (#8371)

This commit is contained in:
Jiralite
2022-07-29 09:47:23 +01:00
committed by GitHub
parent b4e2c0c4d5
commit a7deb8f898
5 changed files with 108 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
'use strict';
const { messageLink } = require('@discordjs/builders');
const { Collection } = require('@discordjs/collection');
const { DiscordSnowflake } = require('@sapphire/snowflake');
const {
@@ -439,7 +440,7 @@ class Message extends Base {
* @readonly
*/
get url() {
return `https://discord.com/channels/${this.guildId ?? '@me'}/${this.channelId}/${this.id}`;
return this.inGuild() ? messageLink(this.channelId, this.id, this.guildId) : messageLink(this.channelId, this.id);
}
/**