Skip to content

Commit 0053421

Browse files
committed
fix: Fixed a bug with the command registry that would not allow any command to be registered
1 parent 3c8e302 commit 0053421

File tree

5 files changed

+39
-16
lines changed

5 files changed

+39
-16
lines changed

docs/com/seailz/test/listeners/TestListener.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ <h2 title="Class TestListener" class="title">Class TestListener</h2>
123123
<li>java.lang.Object</li>
124124
<li>
125125
<ul class="inheritance">
126-
<li>com.seailz.test.listeners.TestListener</li>
126+
<li>TestListener</li>
127127
</ul>
128128
</li>
129129
</ul>

src/main/java/com/seailz/jdaframework/command/registry/CommandRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public CommandRegistry() {
2121
}
2222

2323
public void registerCommand(JDA jda, Command command) {
24-
if (!commands.containsValue(command)) return;
24+
if (commands.containsValue(command)) return;
2525
if (command.getOptions().isEmpty()) {
2626
jda.upsertCommand(command.getName(), command.getDescription()).queue();
2727
} else {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.seailz.test;
2+
3+
import com.seailz.jdaframework.DiscordBot;
4+
import net.dv8tion.jda.api.events.GenericEvent;
5+
import net.dv8tion.jda.api.hooks.EventListener;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import javax.security.auth.login.LoginException;
9+
10+
public class TestBot extends DiscordBot {
11+
12+
public static void main(String[] args) throws LoginException {
13+
new TestBot();
14+
}
15+
public TestBot() throws LoginException {
16+
super("token");
17+
build();
18+
19+
registerCommands(new TestCommand());
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.seailz.test;
2+
3+
import com.seailz.jdaframework.command.Command;
4+
import com.seailz.jdaframework.command.annotation.CommandInfo;
5+
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
6+
7+
@CommandInfo(
8+
name = "test",
9+
description = "Test command"
10+
)
11+
public class TestCommand extends Command {
12+
@Override
13+
public void onCommand(SlashCommandInteractionEvent e) {
14+
e.reply("hi").queue();
15+
}
16+
}

src/test/java/com/seailz/test/listeners/TestListener.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)