Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(Member): Add dynamicAvatarURL #1411

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3120,6 +3120,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