diff --git a/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/SlashCommandTest.java b/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/SlashCommandTest.java new file mode 100644 index 0000000..8f8ef5e --- /dev/null +++ b/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/SlashCommandTest.java @@ -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"); + } + +} diff --git a/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/TestCommand.java b/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/TestCommand.java new file mode 100644 index 0000000..f65f323 --- /dev/null +++ b/wrapper/javacord/src/test/java/net/tomatentum/marinara/test/TestCommand.java @@ -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!"); + } +}