Greenadine / acf-javacord

A Javacord implementation of aikar's Annotation Command Framework (ACF)
Apache License 2.0
2 stars 1 forks source link

Unsure of how to set command prefix because of minimal documentation #1

Closed Aisuma closed 3 years ago

Aisuma commented 3 years ago

Hi, I've just added this to my bot project with Gradle, I have experience using ACF for Minecraft server's but never on anything else, I'm not sure of how to set the prefix and I can't find it anywhere, making my commands useless at the moment.

Greenadine commented 3 years ago

Hi, sorry for the late reply.

To manage which prefixes can be used for your bot's commands, you have to create a custom command config class, like this:

public class ExampleCommandConfig implements CommandConfig {

    @NotNull
    private final List<String> commandPrefixes = new CopyOnWriteArrayList<>(new String[] {"e!"});

    @NotNull
    @Override
    public List<String> getCommandPrefixes() {
        return commandPrefixes;
    }
}

and then using it when creating your CommandManager:

JavacordCommandManager commandManager = new JavacordOptions().configProvider(new ExampleCommandConfig()).create( [DiscordApi instance here] );

I'll also immediately add this to the project's wiki, sorry for the inconvenience. Hope this helps!