Search in sources :

Example 1 with AbstractWidget

use of net.robinfriedli.aiode.command.widget.AbstractWidget in project aiode by robinfriedli.

the class WidgetListener method onGuildMessageReactionAdd.

@Override
public void onGuildMessageReactionAdd(GuildMessageReactionAddEvent event) {
    if (!event.getUser().isBot()) {
        EventHandlerPool.execute(() -> {
            long messageId = event.getMessageIdLong();
            WidgetRegistry widgetRegistry = guildManager.getContextForGuild(event.getGuild()).getWidgetRegistry();
            Optional<AbstractWidget> activeWidget = widgetRegistry.getActiveWidget(messageId);
            activeWidget.ifPresent(abstractWidget -> handleWidgetExecution(event, abstractWidget));
        });
    }
}
Also used : WidgetRegistry(net.robinfriedli.aiode.command.widget.WidgetRegistry) AbstractWidget(net.robinfriedli.aiode.command.widget.AbstractWidget)

Aggregations

AbstractWidget (net.robinfriedli.aiode.command.widget.AbstractWidget)1 WidgetRegistry (net.robinfriedli.aiode.command.widget.WidgetRegistry)1