mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-12 19:18:42 +00:00
[AB-308] adding a separate type for assignable role places to enable booster only places
adding more detailed logging to assignable roles adding some fall through logic to the banned listener to always log at least the basic information refactoring some command structure for showing configuration, so the command actually executes the message response fixing potential exception case for starboard updates causing the message ID to not be persisted
This commit is contained in:
@@ -22,6 +22,11 @@ public class ListenerExecutorConfig {
|
||||
return executorService.setupExecutorFor("leaveListener");
|
||||
}
|
||||
|
||||
@Bean(name = "boostTimeUpdateExecutor")
|
||||
public TaskExecutor boostTimeUpdateExecutor() {
|
||||
return executorService.setupExecutorFor("boostTimeUpdateListener");
|
||||
}
|
||||
|
||||
@Bean(name = "messageReceivedExecutor")
|
||||
public TaskExecutor messageReceivedExecutor() {
|
||||
return executorService.setupExecutorFor("messageReceivedListener");
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package dev.sheldan.abstracto.core.listener.async.jda;
|
||||
|
||||
import dev.sheldan.abstracto.core.listener.ListenerService;
|
||||
import dev.sheldan.abstracto.core.models.listener.BoostTimeUpdatedModel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateBoostTimeEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncMemberBoostTimeUpdateListenerBean extends ListenerAdapter {
|
||||
@Autowired(required = false)
|
||||
private List<AsyncMemberBoostTimeUpdateListener> listenerList;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("boostTimeUpdateExecutor")
|
||||
private TaskExecutor boostTimeUpdateListener;
|
||||
|
||||
@Autowired
|
||||
private ListenerService listenerService;
|
||||
|
||||
@Override
|
||||
public void onGuildMemberUpdateBoostTime(@NotNull GuildMemberUpdateBoostTimeEvent event) {
|
||||
if(listenerList == null) return;
|
||||
BoostTimeUpdatedModel model = getModel(event);
|
||||
listenerList.forEach(boostListener -> listenerService.executeFeatureAwareListener(boostListener, model, boostTimeUpdateListener));
|
||||
}
|
||||
|
||||
private BoostTimeUpdatedModel getModel(GuildMemberUpdateBoostTimeEvent event) {
|
||||
return BoostTimeUpdatedModel
|
||||
.builder()
|
||||
.member(event.getMember())
|
||||
.oldTime(event.getOldTimeBoosted())
|
||||
.newTime(event.getNewTimeBoosted())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user