Skip to content

Commit

Permalink
feat(Webhook): add channel getter (#9074)
Browse files Browse the repository at this point in the history
* fix: add channel property

* fix: missing new line
  • Loading branch information
jaw0r3k committed Feb 17, 2023
1 parent 123d0f1 commit 32cdaff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Webhook {

if ('channel_id' in data) {
/**
* The channel the webhook belongs to
* The id of the channel the webhook belongs to
* @type {Snowflake}
*/
this.channelId = data.channel_id;
Expand Down Expand Up @@ -376,6 +376,15 @@ class Webhook {
});
}

/**
* The channel the webhook belongs to
* @type {?(TextChannel|VoiceChannel|NewsChannel|ForumChannel)}
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelId);
}

/**
* The timestamp the webhook was created at
* @type {number}
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2828,6 +2828,7 @@ export class Webhook extends WebhookMixin() {
private constructor(client: Client, data?: RawWebhookData);
public avatar: string;
public avatarURL(options?: StaticImageURLOptions): string | null;
public readonly channel: TextChannel | VoiceChannel | NewsChannel | ForumChannel | null;
public channelId: Snowflake;
public client: Client;
public guildId: Snowflake;
Expand Down

0 comments on commit 32cdaff

Please sign in to comment.