-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
To start using ACF Javacord, you first must create a new command manager. Depending on what kind of commands you want your bot to have - message (traditional) commands or slash commands - you create either a MessageCommandManager
or SlashCommandManager
. In case you would like to create both kinds of commands for your bot, instead of creating both command managers separately, you can use the convenience class JavacordCommandManager
, which combines the two into one single class.
When you want to use message commands, you must first create a CommandConfig
:
public class ExampleCommandConfig implements CommandConfig {
@NotNull
private final List<String> commandPrefixes = new CopyOnWriteArrayList<>(new String[] {"e!"});
@NotNull
@Override
public List<String> getCommandPrefixes() {
return commandPrefixes;
}
}
After that, you can use it to create the command manager:
DiscordApi api = [YOUR_DISCORD_API_INSTANCE];
MessageCommandManager commandManager = new JavacordOptions().configProvider(new ExampleCommandConfig()).createMessageManager(api);
For slash commands, a CommandConfig
is not needed, instead you create one directly:
DiscordApi api = [YOUR_DISCORD_API_INSTANCE];
JavacordCommandManager commandManager = new JavacordOptions().createSlashManager(api);
Just like when creating a MessageCommandManager
, to create a JavacordCommandManager
you must also first create a CommandConfig
. See above on how to make one.
Once you have, you can create the command manager:
DiscordApi api = [YOUR_DISCORD_API_INSTANCE];
JavacordCommandManager commandManager = new JavacordOptions().configProvider(new ExampleCommandConfig()).createManager(api);