Search in sources :

Example 1 with TextCommand

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

the class CommandsBuilderImpl method processMethod.

private boolean processMethod(Method method) throws InvocationTargetException, InstantiationException, IllegalAccessException {
    for (Class<? extends Annotation> annotation : applicationMethodAnnotations) {
        final ApplicationCommand applicationCommand = tryInstantiateMethod(annotation, ApplicationCommand.class, "Application command", method);
        if (applicationCommand != null) {
            applicationCommandsBuilder.processApplicationCommand(applicationCommand, method);
            return true;
        }
    }
    final TextCommand textCommand = tryInstantiateMethod(JDATextCommand.class, TextCommand.class, "Text command", method);
    if (textCommand != null) {
        prefixedCommandsBuilder.processPrefixedCommand(textCommand, method);
        return true;
    }
    final Object eventListener = tryInstantiateMethod(JDAEventListener.class, Object.class, "JDA event listener", method);
    if (eventListener != null) {
        eventListenersBuilder.processEventListener(eventListener, method);
        return true;
    }
    final Object autocompletionHandler = tryInstantiateMethod(AutocompletionHandler.class, Object.class, "Slash command auto completion", method);
    if (autocompletionHandler != null) {
        autocompletionHandlersBuilder.processHandler(autocompletionHandler, method);
        return true;
    }
    return false;
}
Also used : JDATextCommand(com.freya02.botcommands.api.prefixed.annotations.JDATextCommand) TextCommand(com.freya02.botcommands.api.prefixed.TextCommand) ApplicationCommand(com.freya02.botcommands.api.application.ApplicationCommand)

Aggregations

ApplicationCommand (com.freya02.botcommands.api.application.ApplicationCommand)1 TextCommand (com.freya02.botcommands.api.prefixed.TextCommand)1 JDATextCommand (com.freya02.botcommands.api.prefixed.annotations.JDATextCommand)1