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

Add support for Badges #412

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

Conversation

NickIsADev
Copy link

This pull request creates a new Enum, enum.userFlag, creates a new Resolver, Resolver.userFlag(), a new User getter, get.badges(), and a new User method, User:hasBadge(User-Flag-Resolvable). These all allow for Badges support.

  • get.badges() returns an array of strings which represent the badge's name (which matches up with the Enum).
  • User:hasBadge() returns a boolean indicating whether or not the user has the specified User-Flag-Resolvable.

Most of this was derived from Message Flags to maintain consistency.

Both the getter and the method have been tested.

One thing to note it that the staff badge does not seem to be able to be read due to its bit. I wasn't entirely sure what to do with the enum so I ended up keeping it. Another thing I wasnt so sure about was whether User:hasBadge() should return the flag value, or the badge name. It was agreed upon in the Discordia server that the badge name would be easier to handle.

The raw property of a User that provides the functionality of Badges is User._public_flags. The documentation can be found here.

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