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

Adds support for user's avatar decorations #2668

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

ItsTheSky
Copy link

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

Adds support for the user's decoration avatar. Discord docs are outdated about the user's object, check this PR for the "updated" endpoints.

It's my first PR there, hope I did not break anything 😓

@freya022
Copy link
Contributor

freya022 commented May 4, 2024

avatar_decoration_data is also available on Members, please add Member#getAvatarDecoration as well as Member#getEffectiveAvatarDecoration

@ItsTheSky
Copy link
Author

Do I use the same object present in User for adding support in Member?

@freya022
Copy link
Contributor

freya022 commented May 5, 2024

Yes, same object, but stored on the member, just like any member profile element that's also present on an user

@freya022
Copy link
Contributor

freya022 commented May 5, 2024

As Member and User have a decoration, might as well make AvatarDecoration be its own class, outside of User

@@ -293,6 +293,9 @@ default ImageProxy getAvatar()
return avatarUrl == null ? null : new ImageProxy(avatarUrl);
}

@Nullable
User.AvatarDecoration getAvatarDecoration();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing docs

Comment on lines +27 to +28
public class GuildMemberUpdateAvatarDecorationEvent extends GenericGuildMemberUpdateEvent<User.AvatarDecoration> {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class GuildMemberUpdateAvatarDecorationEvent extends GenericGuildMemberUpdateEvent<User.AvatarDecoration> {
public class GuildMemberUpdateAvatarDecorationEvent extends GenericGuildMemberUpdateEvent<User.AvatarDecoration>
{

import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use javax.annoations instead

@@ -0,0 +1,58 @@
package net.dv8tion.jda.api.events.guild.member.update;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright headers

@@ -0,0 +1,55 @@
package net.dv8tion.jda.api.events.user.update;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing copyright

/**
* Represents the avatar decoration of a {@link User User}.
*/
class AvatarDecoration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing equals() and hashCode(), since you rely on that for update checks.

@DV8FromTheWorld
Copy link
Member

@ItsTheSky what is the status here?

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

Successfully merging this pull request may close these issues.

4 participants