Skip to content

Commit

Permalink
feat(Member): Add dynamicAvatarURL (abalabahaha#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh authored and curtisf committed Jun 11, 2023
1 parent 0005697 commit c795714
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3215,6 +3215,7 @@ declare namespace Eris {
addRole(roleID: string, reason?: string): Promise<void>;
ban(deleteMessageDays?: number, reason?: string): Promise<void>;
edit(options: MemberOptions, reason?: string): Promise<void>;
dynamicAvatarURL(format?: ImageFormat, size?: number): string;
kick(reason?: string): Promise<void>;
removeRole(roleID: string, reason?: string): Promise<void>;
unban(reason?: string): Promise<void>;
Expand Down
13 changes: 13 additions & 0 deletions lib/structures/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ class Member extends Base {
return this.guild.shard.client.editGuildMember.call(this.guild.shard.client, this.guild.id, this.id, options, reason);
}

/**
* Get the member's avatar with the given format and size
* @arg {String} [format] The filetype of the avatar ("jpg", "jpeg", "png", "gif", or "webp")
* @arg {Number} [size] The size of the avatar (any power of two between 16 and 4096)
* @returns {String}
*/
dynamicAvatarURL(format, size) {
if(!this.avatar) {
return this.user.dynamicAvatarURL(format, size);
}
return this.guild.shard.client._formatImage(Endpoints.GUILD_AVATAR(this.guild.id, this.id, this.avatar), format, size);
}

/**
* Kick the member from the guild
* @arg {String} [reason] The reason to be displayed in audit logs
Expand Down

0 comments on commit c795714

Please sign in to comment.