feat (Webhook): v13 add channel prop

#9074 djs
This commit is contained in:
March 7th 2023-01-26 13:52:12 +07:00
parent 377adec3ae
commit 2c4df35bc1
2 changed files with 11 additions and 1 deletions

View File

@ -73,7 +73,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;
@ -110,6 +110,15 @@ class Webhook {
}
}
/**
* The channel the webhook belongs to
* @type {?(TextChannel|VoiceChannel|NewsChannel|ForumChannel)}
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelId);
}
/**
* Options that can be passed into send.
* @typedef {BaseMessageOptions} WebhookMessageOptions

1
typings/index.d.ts vendored
View File

@ -3266,6 +3266,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;