Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(Webhook): add url getter #3178

Merged
merged 4 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
izexi marked this conversation as resolved.
Show resolved Hide resolved
}

static applyToClass(structure) {
for (const prop of [
'send',
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down