Search in sources :

Example 1 with SettingsProvider

use of com.freya02.botcommands.api.SettingsProvider in project BotCommands by freya022.

the class EnableInfoCommand method execute.

@JDATextCommand(name = "enableinfocommand", description = "Enables the /info command")
public void execute(CommandEvent event) {
    if (event.getMember().canInteract(event.getGuild().getSelfMember())) {
        final BasicSettingsProvider settingsProvider = (BasicSettingsProvider) event.getContext().getSettingsProvider();
        if (settingsProvider == null) {
            event.indicateError("No settings provider has been set").queue();
            return;
        }
        settingsProvider.addCommand(event.getGuild(), "info");
        event.reactSuccess().queue();
    } else {
        event.indicateError("You cannot do this").queue();
    }
}
Also used : BasicSettingsProvider(com.freya02.bot.wiki.slash.BasicSettingsProvider) JDATextCommand(com.freya02.botcommands.api.prefixed.annotations.JDATextCommand)

Aggregations

BasicSettingsProvider (com.freya02.bot.wiki.slash.BasicSettingsProvider)1 JDATextCommand (com.freya02.botcommands.api.prefixed.annotations.JDATextCommand)1