Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Command Routers

Maximilian Dorn edited this page Feb 5, 2021 · 2 revisions

Command router

A command router can automatically route interactions to your command framework. The following routers are built in:

To use a router simply set a CommandRouter instance as the listener when submitting a command. Example:

ApplicationCommand myCommand = ...
CommandRouter myRouter = ...
JDASlashCommands.submitGlobalCommand(myCommand, myRouter);

Creating your own router

Creatíng a router for your command framework is quite simple - Just extend the CommandRouter class and implement the route() method.

You can transform your interaction into a command string by calling the protected makeCommandString(Interaction) method. This will return the exact command the user entered. The prefix of the command can be changed by changing the protected prefix field.

Check out the ACFRouter if you want a better example.

Clone this wiki locally