getOptions method
- CommandsPlugin commands
inherited
Return the CommandOptionBuilder
s that represent this entity for slash command registration.
Implementation
@override
List<CommandOptionBuilder> getOptions(CommandsPlugin commands) {
List<CommandOptionBuilder> options = [];
for (final child in children) {
if (child.hasSlashCommand) {
options.add(
CommandOptionBuilder(
type: CommandOptionType.subCommandGroup,
name: child.name,
nameLocalizations: child.localizedNames,
description: child.description,
descriptionLocalizations: child.localizedDescriptions,
options: List.of(child.getOptions(commands)),
),
);
} else if (child is ChatCommand && child.resolvedOptions.type != CommandType.textOnly) {
options.add(
CommandOptionBuilder(
type: CommandOptionType.subCommand,
name: child.name,
nameLocalizations: child.localizedNames,
description: child.description,
descriptionLocalizations: child.localizedDescriptions,
options: List.of(child.getOptions(commands)),
),
);
}
}
return options;
}