Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default permission false by default so that commands default to being usable by everyone #28

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update to new Javacord version
  • Loading branch information
Alan19 committed Oct 22, 2022
commit 3e73a4b331d891315463821435b63a18a1e4f063
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>pw.mihou</groupId>
<artifactId>Velen</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<name>Velen</name>
<description>Velen is a command framework for Javacord that aims to do everything simpler and easier.</description>
<url>https://github.com/ShindouMihou/Velen/</url>
Expand Down Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>org.javacord</groupId>
<artifactId>javacord</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<type>pom</type>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public CompletableFuture<Void> 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)));
}

/**
Expand Down Expand Up @@ -126,7 +126,7 @@ public CompletableFuture<Void> 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<SlashCommand> slashCommands = serverSlashCommands.get(pair.getLeft());
Expand All @@ -151,8 +151,10 @@ public CompletableFuture<Void> observe(Velen velen) {

return api.getGlobalSlashCommands().thenAcceptAsync(slashCommands -> {

List<SlashCommand> 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(),
Expand All @@ -162,7 +164,7 @@ public CompletableFuture<Void> 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)
Expand All @@ -173,8 +175,8 @@ public CompletableFuture<Void> 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()));
}

Expand Down