Skip to content

Commit

Permalink
feat(Webhook): addition of Webhook#avatarURL function (#3625)
Browse files Browse the repository at this point in the history
* feat: addition of Webhook#avatarURL

* typings: added Webhook#avatarURL

* fix: trailing space

* docs: fixed jsdoc function description

* fix: typo
  • Loading branch information
Fyko authored and SpaceEEC committed Dec 15, 2019
1 parent 1237133 commit 330d5db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ class Webhook {
return this.client.options.http.api + this.client.api.webhooks(this.id, this.token);
}

/**
* A link to the webhook's avatar.
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
avatarURL({ format, size } = {}) {
if (!this.avatar) return null;
return this.client.rest.cdn.Avatar(this.id, this.avatar, format, size);
}

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 @@ -1620,6 +1620,7 @@ declare module 'discord.js' {
export class Webhook extends WebhookMixin() {
constructor(client: Client, data?: object);
public avatar: string;
public avatarURL(options?: AvatarOptions): string | null;
public channelID: Snowflake;
public guildID: Snowflake;
public name: string;
Expand Down

0 comments on commit 330d5db

Please sign in to comment.