Add getFullSlashCommand() method to get the SlashCommand annotation instance that has options if it is a rootcommand
This commit is contained in:
parent
0615741def
commit
0c3aeed4f4
@ -3,7 +3,6 @@ package net.tomatentum.marinara.interaction.commands;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand;
|
import net.tomatentum.marinara.interaction.commands.annotation.SlashCommand;
|
||||||
@ -80,6 +79,17 @@ public class SlashCommandDefinition {
|
|||||||
return (SubCommand[]) subCommandMap.values().toArray();
|
return (SubCommand[]) subCommandMap.values().toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SlashCommand getFullSlashCommand() {
|
||||||
|
if (isRootCommand())
|
||||||
|
return getSlashCommand();
|
||||||
|
for (ExecutableSlashCommandDefinition executableSlashCommandDefinition : executableDefinitons) {
|
||||||
|
if (executableSlashCommandDefinition.options().length > 0)
|
||||||
|
return executableSlashCommandDefinition.applicationCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public SlashCommand getSlashCommand() {
|
public SlashCommand getSlashCommand() {
|
||||||
return slashCommand;
|
return slashCommand;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user