-
I was wondering if there was a builder or similar for creating a help command with Slash commands. But more a method or tool that would create and return a list of the registered commands, with their arguments provides. Example: Now calling a specific method in chewtils would create and return this list.
And while I'm at it, does Chewtil offer categorization of the commands? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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");
}
builder.append("\n`").append(event.getPrefix()).append(command.getName())
.append(command.getArguments() == null ? "`" : " " + command.getArguments() + "`")
.append(" - ").append(command.getHelp());
}
event.reply(builder.toString()).queue(); Granted, you would need to fill out |
Beta Was this translation helpful? Give feedback.
The easiest way I can think of is just reverse-engineering the existing help builder.