diff --git a/pom.xml b/pom.xml index 32fc9dc..fcc93ba 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pw.mihou Velen - 3.2.0 + 3.2.3 Velen Velen is a command framework for Javacord that aims to do everything simpler and easier. https://github.com/ShindouMihou/Velen/ @@ -112,7 +112,7 @@ org.javacord javacord - 3.5.0 + 3.7.0 pom diff --git a/src/main/java/pw/mihou/velen/builders/VelenCommandBuilder.java b/src/main/java/pw/mihou/velen/builders/VelenCommandBuilder.java index 0a7597d..aea1e23 100644 --- a/src/main/java/pw/mihou/velen/builders/VelenCommandBuilder.java +++ b/src/main/java/pw/mihou/velen/builders/VelenCommandBuilder.java @@ -31,7 +31,7 @@ public class VelenCommandBuilder { private String name; private final List usages = new ArrayList<>(); private String description; - private boolean defaultPermission = true; + private boolean defaultPermission = false; private VelenSlashEvent velenSlashEvent; private VelenHybridHandler velenHybridHandler; private Duration cooldown; diff --git a/src/main/java/pw/mihou/velen/internals/observer/VelenObserver.java b/src/main/java/pw/mihou/velen/internals/observer/VelenObserver.java index 3130cea..f2fa520 100644 --- a/src/main/java/pw/mihou/velen/internals/observer/VelenObserver.java +++ b/src/main/java/pw/mihou/velen/internals/observer/VelenObserver.java @@ -81,7 +81,7 @@ public CompletableFuture observeServer(Velen velen, Server server) { .filter(s -> s.asSlashCommand().getLeft() != 0L && s.asSlashCommand().getLeft() != null && s.asSlashCommand().getLeft() == server.getId()) .collect(Collectors.toList()); - return server.getSlashCommands().thenAcceptAsync(slashCommands -> commands.forEach(velenCommand -> finalizeServer(server, slashCommands, commands))); + return server.getSlashCommands().thenAcceptAsync(slashCommands -> commands.forEach(velenCommand -> finalizeServer(server, new ArrayList<>(slashCommands), commands))); } /** @@ -126,7 +126,7 @@ public CompletableFuture observeServer(Velen velen, DiscordApi... apis) { + "'s server " + pair.getLeft() + " cannot be found through all " + shards.get(0).getTotalShards() + " shards.")); if (!serverSlashCommands.containsKey(pair.getLeft())) { - serverSlashCommands.put(pair.getLeft(), api.getServerSlashCommands(server).join()); + serverSlashCommands.put(pair.getLeft(), new ArrayList<>(api.getServerSlashCommands(server).join())); } List slashCommands = serverSlashCommands.get(pair.getLeft()); @@ -151,8 +151,10 @@ public CompletableFuture observe(Velen velen) { return api.getGlobalSlashCommands().thenAcceptAsync(slashCommands -> { + List slashCommandList = new ArrayList<>(slashCommands); + if (mode.isCreate()) { - existentialFilter(commands, slashCommands).forEach(command -> { + existentialFilter(commands, slashCommandList).forEach(command -> { long start = System.currentTimeMillis(); command.asSlashCommand().getRight().createGlobal(api).thenAccept(slashCommand -> logger.info("Application command was created. [name={}, description={}, id={}]. It took {} milliseconds.", slashCommand.getName(), slashCommand.getDescription(), @@ -162,7 +164,7 @@ public CompletableFuture observe(Velen velen) { } if (mode.isUpdate()) { - crustFilter(commands, slashCommands).forEach((aLong, velenCommand) -> { + crustFilter(commands, slashCommandList).forEach((aLong, velenCommand) -> { long start = System.currentTimeMillis(); velenCommand.asSlashCommandUpdater(aLong).getRight().updateGlobal(api) @@ -173,8 +175,8 @@ public CompletableFuture observe(Velen velen) { } if (!mode.isUpdate() && !mode.isCreate()) { - existentialFilter(commands, slashCommands).forEach(command -> logger.warn("Application command is not registered on Discord API. [{}]", command.toString())); - crustFilter(commands, slashCommands).forEach((aLong, velenCommand) -> + existentialFilter(commands, slashCommandList).forEach(command -> logger.warn("Application command is not registered on Discord API. [{}]", command.toString())); + crustFilter(commands, slashCommandList).forEach((aLong, velenCommand) -> logger.warn("Application command requires updating. [id={}, {}]", aLong, velenCommand.toString())); }