The user facing API designs #50
Closed
surajkumar
started this conversation in
Ideas
Replies: 2 comments
-
Just for some context, JDA and Javacord follow the traditional pattern. The annotations way is influenced by the Spring framework and Discord4j does this type of syntax: gateway.on(MessageCreateEvent.class).subscribe(event -> {
Message message = event.getMessage();
if ("!ping".equals(message.getContent())) {
MessageChannel channel = message.getChannel().block();
channel.createMessage("Pong!").block();
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Nobody has voted against the annotation based processing so this will be implemented. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
User Facing API Discussion
We should have this discussion out in the open so we can all come to a consensus on what the best approach should be for the user facing API.
There are 2 styles we could implement;
Traditional
The "traditional" method would like so:
This is how a lot of the existing solutions do it and it's not particularly a bad one.
Pros:
Cons:
Annotations
This would then automatically get created by the library so the user does not need to explicity bind the handler.
Pros:
Cons:
Any other ideas? What do you guys think between the traditional and annotations based methods? Should we explore other patterns for the end user?
Some other ideas I have is following an Aspect Oriented Programming approach.
Beta Was this translation helpful? Give feedback.
All reactions