forked from SteamWar/SteamWar
Update CouncilChannel
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.velocitycore.discord.channels;
|
||||
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
@@ -29,6 +30,7 @@ import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel;
|
||||
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CouncilChannel extends StaticMessageChannel {
|
||||
@@ -36,11 +38,12 @@ public class CouncilChannel extends StaticMessageChannel {
|
||||
private static final Map<Role, CouncilChannel> channels = new HashMap<>();
|
||||
|
||||
public static void update(List<Role> roles) {
|
||||
for(Role role : roles) {
|
||||
if (channels.containsKey(role)) {
|
||||
channels.get(role).update();
|
||||
}
|
||||
}
|
||||
VelocityCore.schedule(() -> {
|
||||
roles.stream()
|
||||
.filter(channels::containsKey)
|
||||
.map(channels::get)
|
||||
.forEach(CouncilChannel::update);
|
||||
}).delay(1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public CouncilChannel(Role role, ThreadChannel threadChannel) {
|
||||
|
||||
Reference in New Issue
Block a user