Skip to content

add 'Button' class and 'setButtons' method for RichPresence#3

Open
Niwer1525 wants to merge 1 commit into
CDAGaming:masterfrom
Niwer1525:master
Open

add 'Button' class and 'setButtons' method for RichPresence#3
Niwer1525 wants to merge 1 commit into
CDAGaming:masterfrom
Niwer1525:master

Conversation

@Niwer1525
Copy link
Copy Markdown

This PR introduces a fluent, Java-based API for constructing Discord Rich Presence buttons.

Currently, adding buttons requires manual JSON manipulation or direct interaction with the GSON library. This change abstracts those implementation details, allowing developers to define buttons using standard Java objects, improving type safety and code readability. (While maintaining backward compatibility for those who prefer to use JSON-based approach).

Input Validation:

  • null variables.
  • Empty strings for labels or URLs.
  • Max label and URLs sizes.
presence_builder.setButtons( // varargs
 new Button("Join Me", "https://example.com"),
 new Button("Another Cool Button", "https://example.com")
);

I hope this addition proves useful! If you have any questions or feedback regarding the implementation, please don't hesitate to reach out.

- Added Button class for easier Java-based construction.
- Added setButtons method to RichPresence.
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