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

Update .avatar_url to .display_avatar #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cgarz
Copy link

@cgarz cgarz commented Oct 28, 2024

Fixes:

ERROR - Error on on_message: (<class 'AttributeError'>, AttributeError("'Member' object has no attribute 'avatar_url'")

Relevant info from discord.py discord's R. Danny bot:

1.x: https://discordpy.readthedocs.io/en/stable/api.html#discord.User.avatar_url

In 2.0, .avatar_url has been replaced with .avatar. https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar.
1.x's .avatar has been moved to .avatar.key in 2.0.

.display_avatar has also been added to 2.0. This gets the avatar in the following order:

  • Guild avatar
  • User avatar
  • Default avatar

This will ALWAYS return a Asset object, while .avatar can return both Asset and None if the user has no user avatar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant