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

Add per-guild avatar support #7054

Closed
JustAnyones opened this issue Jun 12, 2021 · 1 comment
Closed

Add per-guild avatar support #7054

JustAnyones opened this issue Jun 12, 2021 · 1 comment
Labels
feature request This is a feature request.

Comments

@JustAnyones
Copy link
Contributor

Summary

Add support for per-guild member avatars

What is the feature request for?

The core library

The Problem

See discord/discord-api-docs#3081.
Feature implementation would allow bots to access per-guild member avatars.

The Ideal Solution

Ideally, it would be implemented as a member object method like Member.avatar_url_as()

The Current Solution

Right now, I use a very hacky solution which includes hackily getting the full member object and then checking whether the avatar field is available and returning the correct URL based on that.

format = 'png'
size = 256

user_data = await client._get_state().http.get_member(guild.id, member.id)
avatar = user_data["avatar"]
if avatar is None:
    return None
# Basically, replicates Asset._from_avatar behaviour
format = 'gif' if avatar.startswith('a_') else format
return f"https://cdn.discordapp.com/guilds/{guild.id}/users/{member.id}/avatars/{avatar}.{format}?size={size}"

Additional Context

No response

@JustAnyones JustAnyones added the feature request This is a feature request. label Jun 12, 2021
@Rapptz
Copy link
Owner

Rapptz commented Jun 12, 2021

This is being worked on already. Note that v1.x won't get any new features and asset was redesigned in v2 so your proposed API won't make it in.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature request This is a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants