Search in sources :

Example 6 with Description

use of com.freya02.botcommands.api.prefixed.annotations.Description 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

CommandPath (com.freya02.botcommands.api.application.CommandPath)4 SlashCommandInfo (com.freya02.botcommands.internal.application.slash.SlashCommandInfo)3 Command (net.dv8tion.jda.api.interactions.commands.Command)3 NotNull (org.jetbrains.annotations.NotNull)3 Logging (com.freya02.botcommands.api.Logging)2 MessageCommandInfo (com.freya02.botcommands.internal.application.context.message.MessageCommandInfo)2 UserCommandInfo (com.freya02.botcommands.internal.application.context.user.UserCommandInfo)2 java.util (java.util)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Nullable (org.jetbrains.annotations.Nullable)2 Logger (org.slf4j.Logger)2 BasicSettingsProvider (com.freya02.bot.wiki.slash.BasicSettingsProvider)1 SettingsProvider (com.freya02.botcommands.api.SettingsProvider)1 DebugBuilder (com.freya02.botcommands.api.builder.DebugBuilder)1 Emoji (com.freya02.botcommands.api.entities.Emoji)1 EmojiOrEmote (com.freya02.botcommands.api.entities.EmojiOrEmote)1 QuotableRegexParameterResolver (com.freya02.botcommands.api.parameters.QuotableRegexParameterResolver)1 BaseCommandEvent (com.freya02.botcommands.api.prefixed.BaseCommandEvent)1 Category (com.freya02.botcommands.api.prefixed.annotations.Category)1