Code Monkey home page Code Monkey logo

slash-commands's People

Contributors

azzerial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

justlumia

slash-commands's Issues

Wait for JDA ready status

Ensure that the JDA status is READY before building the SlashClient. (Otherwise, the guilds wouldn't load)

Implement SelectionMenu

Implement the JDA component SelectionMenu (Discord's select menus). As for the SlashButton, the object should have the Slash prefix (so SlashSelectionMenu).

Note: Need to wait for JDA to release the feature first.

Create @Option.Bind annotation

Create the @Option.Bind annotation that can be placed before a method parameter (of a @Slash.Handler) and that binds the option to the parameter. This allows the option to be passed as typed parameter to shortcut the traditional JDA way of getting the options.

Note: In case the options cannot be mapped to the parameter type, the method would not be called.

Note: In case an option is a union type (as for the MENTIONABLE), it would be possible to create multiple @Slash.Handler methods with different parameter types for the option. The api would then call the most appropriate method.

Note: A default value (for non-required options only) should be added to the @Option.Bind.

Example

For a simple kick command, the current way of writing it

@Slash.Handler()
public void kick(SlashCommandEvent event) {
    final User user = Objects.requireNonNull(event.getOption("user")).getAsUser();
    final String reason = Objects.requireNonNull(event.getOption("reason")).getAsString();

    ...
}

would become

@Slash.Handler()
public void kick(SlashCommandEvent event, @Option.Bind("user") User user, @Option.Bind("reason") String reason) {
    ...
}

Add lambda callback to SlashButtons

The lambda callback should be added to the SlashButton class such as SlashButton#style(String label, Consumer<ButtonClickEvent> lambda).

SlashButton.primary("Refresh", event -> { ... });

Note: In order to make the lambda callbacks persistent, a pre-processing would be interesting. We would first create a registry/cache for all the callbacks (map index to callback).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.