diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 2ed6137b40a7..da7dcd12fafa 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -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', diff --git a/typings/index.d.ts b/typings/index.d.ts index abab6b9546b3..cb2ccda02ef5 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -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;