use of net.dv8tion.jda.api.events.interaction.SlashCommandEvent in project TJ-Bot by Together-Java.
the class TagCommandTest method canNotFindTagSuggestDifferentTag.
@Test
@DisplayName("Respond that the tag could not be found but suggest a different tag instead, if the system has a different tag registered")
void canNotFindTagSuggestDifferentTag() {
// GIVEN a system with the tag "first" registered
system.putTag("first", "foo");
// WHEN triggering the slash command '/tag id:second'
SlashCommandEvent event = triggerSlashCommand("second", null);
// THEN responds that the tag could not be found and instead suggests using the other tag
verify(event).reply("Could not find any tag with id 'second', did you perhaps mean 'first'?");
}
use of net.dv8tion.jda.api.events.interaction.SlashCommandEvent in project TJ-Bot by Together-Java.
the class TagCommandTest method canNotFindTagInEmptySystem.
@Test
@DisplayName("Respond that the tag could not be found if the system has no tags registered yet")
void canNotFindTagInEmptySystem() {
// GIVEN a system without any tags registered
// WHEN triggering the slash command '/tag id:first'
SlashCommandEvent event = triggerSlashCommand("first", null);
// THEN responds that the tag could not be found
verify(event).reply("Could not find any tag with id 'first'.");
}
use of net.dv8tion.jda.api.events.interaction.SlashCommandEvent in project TJ-Bot by Together-Java.
the class TagCommandTest method canFindTheTagAndRespondWithContent.
@Test
@DisplayName("Respond with the tags content if the tag could be found")
void canFindTheTagAndRespondWithContent() {
// GIVEN a system with the tag "first" registered
system.putTag("first", "foo");
// WHEN triggering the slash command '/tag id:first'
SlashCommandEvent event = triggerSlashCommand("first", null);
// THEN finds the tag and responds with its content
verify(event).replyEmbeds(any(MessageEmbed.class));
}
use of net.dv8tion.jda.api.events.interaction.SlashCommandEvent in project TJ-Bot by Together-Java.
the class TagManageCommandTest method rawTagCanNotFindUnknownTag.
@Test
@DisplayName("'/tag-manage raw' can not be used on unknown tags")
void rawTagCanNotFindUnknownTag() {
// GIVEN a tag system without any tags
// WHEN using '/tag-manage raw id:unknown'
SlashCommandEvent event = triggerRawCommand("unknown");
// THEN the command can not find the tag and responds accordingly
verify(event).reply(startsWith("Could not find any tag"));
}
use of net.dv8tion.jda.api.events.interaction.SlashCommandEvent in project TJ-Bot by Together-Java.
the class TagManageCommandTest method triggerTagContentCommand.
@NotNull
private SlashCommandEvent triggerTagContentCommand(@NotNull TagManageCommand.Subcommand subcommand, @NotNull String tagId, @NotNull String content) {
SlashCommandEvent event = jdaTester.createSlashCommandEvent(command).setSubcommand(subcommand.getName()).setOption(TagManageCommand.ID_OPTION, tagId).setOption(TagManageCommand.CONTENT_OPTION, content).setUserWhoTriggered(moderator).build();
command.onSlashCommand(event);
return event;
}
Aggregations