feat(channel): add .url getter (#7402)

Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Milo
2022-02-09 08:18:30 +00:00
committed by GitHub
parent 09098240bf
commit f59d6305cb
2 changed files with 10 additions and 0 deletions

View File

@@ -57,6 +57,15 @@ class Channel extends Base {
return new Date(this.createdTimestamp);
}
/**
* The URL to the channel
* @type {string}
* @readonly
*/
get url() {
return `https://discord.com/channels/${this.isDMBased() ? '@me' : this.guildId}/${this.id}`;
}
/**
* Whether this Channel is a partial
* <info>This is always false outside of DM channels.</info>

View File

@@ -494,6 +494,7 @@ export abstract class Channel extends Base {
public id: Snowflake;
public readonly partial: false;
public type: ChannelType;
public readonly url: string;
public delete(): Promise<this>;
public fetch(force?: boolean): Promise<this>;
public isText(): this is TextChannel;