use of net.robinfriedli.aiode.command.widget.WidgetRegistry in project aiode by robinfriedli.
the class WidgetListener method onGuildMessageDelete.
@Override
public void onGuildMessageDelete(@NotNull GuildMessageDeleteEvent event) {
EventHandlerPool.execute(() -> {
WidgetRegistry widgetRegistry = guildManager.getContextForGuild(event.getGuild()).getWidgetRegistry();
widgetRegistry.getActiveWidget(event.getMessageIdLong()).ifPresent(widget -> {
widget.setMessageDeleted(true);
widget.destroy();
});
});
}
use of net.robinfriedli.aiode.command.widget.WidgetRegistry in project aiode by robinfriedli.
the class AudioManager method createNowPlayingWidget.
void createNowPlayingWidget(CompletableFuture<Message> futureMessage, AudioPlayback playback) {
Guild guild = playback.getGuild();
WidgetRegistry widgetRegistry = guildManager.getContextForGuild(guild).getWidgetRegistry();
CompletableFutures.thenAccept(futureMessage, message -> new NowPlayingWidget(widgetRegistry, guild, message).initialise());
}
use of net.robinfriedli.aiode.command.widget.WidgetRegistry in project aiode by robinfriedli.
the class QueueCommand method listQueue.
private void listQueue() {
Guild guild = getContext().getGuild();
AudioManager audioManager = Aiode.get().getAudioManager();
AudioPlayback playback = audioManager.getPlaybackForGuild(guild);
AudioQueue audioQueue = playback.getAudioQueue();
CompletableFuture<Message> futureMessage = sendMessage(audioQueue.buildMessageEmbed(playback, guild));
WidgetRegistry widgetRegistry = getContext().getGuildContext().getWidgetRegistry();
CompletableFutures.thenAccept(futureMessage, message -> new QueueWidget(widgetRegistry, guild, message, playback).initialise());
}
use of net.robinfriedli.aiode.command.widget.WidgetRegistry 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));
});
}
}
Aggregations