Skip to content

Is there a help command builder for slash commands? #15

Answered by Chew
Andre601 asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest way I can think of is just reverse-engineering the existing help builder.

// Inside an execute(SlashCommandEvent event)
var client = event.getClient();
var commands = client.getSlashCommands();

// Get categories
StringBuilder builder = new StringBuilder("**" + event.getSelfUser().getName() + "** commands:\n");
Command.Category category = null;
for (Command command : event.getClient().getCommands()) {
    if (command.isHidden() || command.isOwnerCommand()) continue;
    if (!Objects.equals(category, command.getCategory())) {
        category = command.getCategory();
        builder.append("\n\n  __").append(category == null ? "No Category" : category.getName()).append("__:\n")…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Andre601
Comment options

Answer selected by Andre601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants