use of net.robinfriedli.aiode.entities.xml.GuildPropertyContribution in project aiode by robinfriedli.
the class PropertyCommand method describeProperty.
private void describeProperty() {
GuildPropertyManager guildPropertyManager = Aiode.get().getGuildPropertyManager();
String propertyName = getCommandInput();
AbstractGuildProperty property = guildPropertyManager.getPropertyByName(propertyName);
if (property != null) {
GuildPropertyContribution contribution = property.getContribution();
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setTitle("Property " + contribution.getName());
embedBuilder.setDescription(contribution.getDescription());
long acceptedValuesCount = contribution.query(tagName("acceptedValue")).count();
if (acceptedValuesCount > 0) {
embedBuilder.addField("Accepted values", contribution.getAcceptedValuesString(), false);
}
sendMessage(embedBuilder);
} else {
throw new InvalidCommandException(String.format("No such property '%s'", propertyName));
}
}
Aggregations