-
-
Notifications
You must be signed in to change notification settings - Fork 1
Command Synchronization
Nexus simplifies and streamlines command synchronization with an easy-to-use approach. To synchronize commands, you only need to include the following line in your code:
Nexus.synchronizer.synchronize()
As commands can pertain to multiple servers, Nexus employs customized handling for Futures, which also encompasses error management. To handle errors effectively, incorporate .addTaskErrorListener(...)
which functions similarly to .exceptionally(...)
. Similarly, .addTaskCompletionListener(...)
resembles .thenAccept(...)
, yet it's focused on individual tasks. If you aim to monitor the overall completion of all tasks, utilize .addFinalTaskCompletionListener(...)
instead.
An example of handling synchronization properly would be:
Nexus.synchronizer
.synchronize()
.addFinalCompletionListener { println("Successfully migrated all commands to Discord.") }
.addTaskErrorListener { exception ->
println("An error occurred while trying to migrate commands to Discord:")
exception.printStackTrace()
}
To gain a deeper understanding of how the synchronizer can be used for various tasks, refer to our example:
All information in this wiki was written during v1.2.0
, we recommend updating to that version if you are below, or creating an issue in GitHub, updating the wiki if the current information is missing, outdated or lacking.
To get started with Nexus, we recommend reading the following in chronological:
- Installation & Preparing Nexus
- Designing Commands
- Command Interceptors
- Additional Features (Subcommand Router, Option Validation)
- Context Menus
- Command Synchronization
You may want to read a specific part of handling command and middleware responses:
You can also read about additional features of Nexus:
- Subcommand Routing
- Option Validation
- Express Way (shard management)
- Inheritance
- Feather Pagination
- Nexus.R
You can read about synchronizing commands to Discord:
For more additional performance:
Additional configurations: