use of net.robinfriedli.aiode.discord.property.GuildPropertyManager 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));
}
}
use of net.robinfriedli.aiode.discord.property.GuildPropertyManager in project aiode by robinfriedli.
the class VoiceChannelListener method isAutoPauseEnabled.
private boolean isAutoPauseEnabled(Guild guild) {
return hibernateComponent.invokeWithSession(session -> {
GuildPropertyManager guildPropertyManager = Aiode.get().getGuildPropertyManager();
GuildManager guildManager = Aiode.get().getGuildManager();
GuildSpecification specification = guildManager.getContextForGuild(guild).getSpecification(session);
return guildPropertyManager.getPropertyValueOptional("enableAutoPause", Boolean.class, specification).orElse(true);
});
}
use of net.robinfriedli.aiode.discord.property.GuildPropertyManager in project aiode by robinfriedli.
the class QueueIterator method shouldSendPlaybackNotification.
private boolean shouldSendPlaybackNotification() {
return StaticSessionProvider.invokeWithSession(session -> {
Guild guild = playback.getGuild();
GuildSpecification specification = Aiode.get().getGuildManager().getContextForGuild(guild).getSpecification(session);
GuildPropertyManager guildPropertyManager = Aiode.get().getGuildPropertyManager();
return guildPropertyManager.getPropertyValueOptional("sendPlaybackNotification", Boolean.class, specification).orElse(true);
});
}
use of net.robinfriedli.aiode.discord.property.GuildPropertyManager in project aiode by robinfriedli.
the class ColorSchemeProperty method getColor.
public static Color getColor() {
GuildPropertyManager guildPropertyManager = Aiode.get().getGuildPropertyManager();
ColorSchemeProperty colorProperty = (ColorSchemeProperty) guildPropertyManager.getProperty("color");
if (colorProperty != null) {
if (ExecutionContext.Current.isSet()) {
return colorProperty.getAsColor();
} else {
return ColorSchemeProperty.parseColor(colorProperty.getDefaultValue());
}
}
return DEFAULT_FALLBACK;
}
use of net.robinfriedli.aiode.discord.property.GuildPropertyManager in project aiode by robinfriedli.
the class PrefixProperty method getForContext.
public static String getForContext(GuildContext guildContext, Session session) {
GuildSpecification specification = guildContext.getSpecification(session);
GuildPropertyManager guildPropertyManager = Aiode.get().getGuildPropertyManager();
return guildPropertyManager.getPropertyValueOptional("prefix", String.class, specification).orElse(DEFAULT_FALLBACK);
}
Aggregations