forked from SteamWar/SteamWar
Make it buildable and reduce complexity
This commit is contained in:
@@ -32,7 +32,7 @@ public class ChecklistChannel extends DiscordChannel {
|
||||
private final List<Integer> lastSchematics = new ArrayList<>();
|
||||
|
||||
public ChecklistChannel(String channel) {
|
||||
super(channel);
|
||||
super(channel, 0);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
@@ -68,8 +68,16 @@ public class DiscordChannel extends Chatter.PlayerlessChatter {
|
||||
public DiscordChannel(MessageChannel channel, int maxNumberOfWebhooks) {
|
||||
this(maxNumberOfWebhooks, SteamwarUser.get(-1), channel);
|
||||
ChannelListener.getChannels().put(this.channel, this);
|
||||
|
||||
if (channel instanceof TextChannel) {
|
||||
webhooks.addAll(((TextChannel) channel).retrieveWebhooks().complete());
|
||||
TextChannel textChannel = (TextChannel) channel;
|
||||
webhooks.addAll(textChannel.retrieveWebhooks().complete());
|
||||
while (webhooks.size() > maxNumberOfWebhooks) {
|
||||
webhooks.remove().delete().queue();
|
||||
}
|
||||
while (webhooks.size() < maxNumberOfWebhooks) {
|
||||
webhooks.add(textChannel.createWebhook(DiscordBot.getInstance().getJda().getSelfUser().getName()).complete());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,10 +110,6 @@ public class DiscordChannel extends Chatter.PlayerlessChatter {
|
||||
avatarUrl = DiscordBot.getInstance().getJda().getSelfUser().getAvatarUrl();
|
||||
}
|
||||
|
||||
TextChannel textChannel = (TextChannel) getChannel();
|
||||
if (webhooks.size() < maxNumberOfWebhooks) {
|
||||
webhooks.add(textChannel.createWebhook(DiscordBot.getInstance().getJda().getSelfUser().getName() + "_" + webhooks.size()).complete());
|
||||
}
|
||||
Webhook webhook = webhooks.poll();
|
||||
webhooks.add(webhook);
|
||||
|
||||
|
||||
+2
-2
@@ -46,14 +46,14 @@ public class StaticMessageChannel extends DiscordChannel {
|
||||
}
|
||||
|
||||
public StaticMessageChannel(String channel, Supplier<MessageCreateBuilder> supplier, Consumer<GenericComponentInteractionCreateEvent> interaction) {
|
||||
super(channel);
|
||||
super(channel, 0);
|
||||
this.supplier = supplier;
|
||||
this.interaction = interaction;
|
||||
init();
|
||||
}
|
||||
|
||||
public StaticMessageChannel(MessageChannel channel, Supplier<MessageCreateBuilder> supplier, Consumer<GenericComponentInteractionCreateEvent> interaction) {
|
||||
super(channel);
|
||||
super(channel, 0);
|
||||
this.supplier = supplier;
|
||||
this.interaction = interaction;
|
||||
init();
|
||||
|
||||
Reference in New Issue
Block a user