This repository was archived by the owner on Jun 23, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Command Routers
Maximilian Dorn edited this page Feb 5, 2021
·
2 revisions
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);
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.