mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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>
|
||||
|
||||
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user