Add Javacord test
This commit is contained in:
parent
9d81522429
commit
9f87f47b1f
@ -0,0 +1,25 @@
|
||||
package net.tomatentum.marinara.test;
|
||||
|
||||
import org.javacord.api.DiscordApi;
|
||||
import org.javacord.api.DiscordApiBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.tomatentum.marinara.Marinara;
|
||||
import net.tomatentum.marinare.wrapper.javacord.JavacordWrapper;
|
||||
|
||||
public class SlashCommandTest {
|
||||
|
||||
String DISCORD_TOKEN = System.getenv("DISCORD_TEST_TOKEN");
|
||||
|
||||
@Test
|
||||
public void testSlashCommand() {
|
||||
DiscordApi api = new DiscordApiBuilder()
|
||||
.setToken(DISCORD_TOKEN)
|
||||
.login().join();
|
||||
Marinara marinara = Marinara.load(new JavacordWrapper(api));
|
||||
marinara.getRegistry().addInteractions(new TestCommand());
|
||||
marinara.getRegistry().registerCommands();
|
||||
System.out.println("done");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package net.tomatentum.marinara.test;
|
||||
|
||||
import org.javacord.api.interaction.SlashCommandInteraction;
|
||||
|
||||
import net.tomatentum.marinara.interaction.InteractionHandler;
|
||||
import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand;
|
||||
import net.tomatentum.marinara.interaction.commands.annotation.SlashCommandOption;
|
||||
import net.tomatentum.marinara.interaction.commands.option.SlashCommandOptionType;
|
||||
|
||||
public class TestCommand implements InteractionHandler {
|
||||
@SlashCommand(
|
||||
name = "test",
|
||||
description = "testingen",
|
||||
serverIds = {
|
||||
1037753048602255440L
|
||||
},
|
||||
options = {
|
||||
@SlashCommandOption(
|
||||
name = "pommes",
|
||||
description = "mit Fett",
|
||||
type = SlashCommandOptionType.MENTIONABLE
|
||||
)
|
||||
}
|
||||
)
|
||||
public void exec(SlashCommandInteraction interaction) {
|
||||
System.out.println("Success!");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user