remove redundant getFullSlashCommand
This commit is contained in:
parent
8f14b0feb9
commit
9058629af5
@ -81,8 +81,8 @@ public class Discord4JWrapper extends LibraryWrapper {
|
|||||||
|
|
||||||
for (SlashCommandDefinition slashCommandDefinition : defs) {
|
for (SlashCommandDefinition slashCommandDefinition : defs) {
|
||||||
ApplicationCommandRequest request = convertSlashCommand(slashCommandDefinition);
|
ApplicationCommandRequest request = convertSlashCommand(slashCommandDefinition);
|
||||||
if (slashCommandDefinition.getFullSlashCommand().serverIds().length > 0) {
|
if (slashCommandDefinition.getSlashCommand().serverIds().length > 0) {
|
||||||
for (long serverId : slashCommandDefinition.getFullSlashCommand().serverIds()) {
|
for (long serverId : slashCommandDefinition.getSlashCommand().serverIds()) {
|
||||||
serverCommands.putIfAbsent(serverId, new ArrayList<>());
|
serverCommands.putIfAbsent(serverId, new ArrayList<>());
|
||||||
serverCommands.get(serverId).add(request);
|
serverCommands.get(serverId).add(request);
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ public class Discord4JWrapper extends LibraryWrapper {
|
|||||||
|
|
||||||
private ApplicationCommandRequest convertSlashCommand(SlashCommandDefinition def) {
|
private ApplicationCommandRequest convertSlashCommand(SlashCommandDefinition def) {
|
||||||
List<ApplicationCommandOptionData> options = new ArrayList<>();
|
List<ApplicationCommandOptionData> options = new ArrayList<>();
|
||||||
SlashCommand cmd = def.getFullSlashCommand();
|
SlashCommand cmd = def.getSlashCommand();
|
||||||
if (!def.isRootCommand()) {
|
if (!def.isRootCommand()) {
|
||||||
Arrays.stream(def.getSubCommands(null)).map(this::convertSubCommandDef).forEach(options::add);
|
Arrays.stream(def.getSubCommands(null)).map(this::convertSubCommandDef).forEach(options::add);
|
||||||
Arrays.stream(def.getSubCommandGroups()).map((x) -> convertSubCommandGroupDef(def, x)).forEach(options::add);
|
Arrays.stream(def.getSubCommandGroups()).map((x) -> convertSubCommandGroupDef(def, x)).forEach(options::add);
|
||||||
@ -191,6 +191,7 @@ public class Discord4JWrapper extends LibraryWrapper {
|
|||||||
builder.value(choice.doubleValue());
|
builder.value(choice.doubleValue());
|
||||||
if (!choice.stringValue().isEmpty())
|
if (!choice.stringValue().isEmpty())
|
||||||
builder.value(choice.stringValue());
|
builder.value(choice.stringValue());
|
||||||
|
convertedChoices.add(builder.build());
|
||||||
}
|
}
|
||||||
return convertedChoices;
|
return convertedChoices;
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,8 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
Set<SlashCommandBuilder> globalCommands = new HashSet<>();
|
Set<SlashCommandBuilder> globalCommands = new HashSet<>();
|
||||||
for (SlashCommandDefinition slashCommandDefinition : defs) {
|
for (SlashCommandDefinition slashCommandDefinition : defs) {
|
||||||
SlashCommandBuilder builder = convertSlashCommand(slashCommandDefinition);
|
SlashCommandBuilder builder = convertSlashCommand(slashCommandDefinition);
|
||||||
if (slashCommandDefinition.getFullSlashCommand().serverIds().length > 0) {
|
if (slashCommandDefinition.getSlashCommand().serverIds().length > 0) {
|
||||||
for (long serverId : slashCommandDefinition.getFullSlashCommand().serverIds()) {
|
for (long serverId : slashCommandDefinition.getSlashCommand().serverIds()) {
|
||||||
serverCommands.putIfAbsent(serverId, new HashSet<>());
|
serverCommands.putIfAbsent(serverId, new HashSet<>());
|
||||||
serverCommands.get(serverId).add(builder);
|
serverCommands.get(serverId).add(builder);
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
|
|
||||||
private SlashCommandBuilder convertSlashCommand(SlashCommandDefinition def) {
|
private SlashCommandBuilder convertSlashCommand(SlashCommandDefinition def) {
|
||||||
List<org.javacord.api.interaction.SlashCommandOption> options = new ArrayList<>();
|
List<org.javacord.api.interaction.SlashCommandOption> options = new ArrayList<>();
|
||||||
SlashCommand cmd = def.getFullSlashCommand();
|
SlashCommand cmd = def.getSlashCommand();
|
||||||
if (!def.isRootCommand()) {
|
if (!def.isRootCommand()) {
|
||||||
Arrays.stream(def.getSubCommands(null)).map(this::convertSubCommandDef).forEach(options::add);
|
Arrays.stream(def.getSubCommands(null)).map(this::convertSubCommandDef).forEach(options::add);
|
||||||
Arrays.stream(def.getSubCommandGroups()).map((x) -> convertSubCommandGroupDef(def, x)).forEach(options::add);
|
Arrays.stream(def.getSubCommandGroups()).map((x) -> convertSubCommandGroupDef(def, x)).forEach(options::add);
|
||||||
@ -164,6 +164,7 @@ public class JavacordWrapper extends LibraryWrapper {
|
|||||||
*/
|
*/
|
||||||
if (!choice.stringValue().isEmpty())
|
if (!choice.stringValue().isEmpty())
|
||||||
builder.setValue(choice.stringValue());
|
builder.setValue(choice.stringValue());
|
||||||
|
convertedChoices.add(builder.build());
|
||||||
}
|
}
|
||||||
return convertedChoices;
|
return convertedChoices;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user