From c078682722541713c9ac30f6777d6dafe560fcb5 Mon Sep 17 00:00:00 2001 From: izexi <43889168+izexi@users.noreply.github.com> Date: Fri, 5 Apr 2019 10:09:58 +0100 Subject: [PATCH] feat(Webhook): add url getter (#3178) * add Webhook#url * set typing as readonly * suggested change * another one --- src/structures/Webhook.js | 9 +++++++++ typings/index.d.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 472de07ea..1ad7cba93 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -213,6 +213,15 @@ class Webhook { return this.client.api.webhooks(this.id, this.token).delete({ reason }); } + /** + * The url of this webhook + * @type {string} + * @readonly + */ + get url() { + return this.client.options.http.api + this.client.api.webhooks(this.id, this.token); + } + static applyToClass(structure) { for (const prop of [ 'send', diff --git a/typings/index.d.ts b/typings/index.d.ts index f1547c876..53857b338 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1270,6 +1270,7 @@ declare module 'discord.js' { public guildID: Snowflake; public name: string; public owner: User | object; + public readonly url: string; } export class WebhookClient extends WebhookMixin(BaseClient) {