From 2c4df35bc1a2f91464adbb08d447907a2814ca24 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:52:12 +0700 Subject: [PATCH] feat (Webhook): v13 add `channel` prop #9074 djs --- src/structures/Webhook.js | 11 ++++++++++- typings/index.d.ts | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 814f504..013f38f 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -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 diff --git a/typings/index.d.ts b/typings/index.d.ts index 51be339..bf11ff4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -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;