use of tk.ardentbot.rethink.models.MusicSettingsModel in project Ardent by adamint.
the class Music method getOutputChannel.
static TextChannel getOutputChannel(Guild guild) throws SQLException {
String id;
MusicSettingsModel guildMusicSettings = BaseCommand.asPojo(r.db("data").table("music_settings").get(guild.getId()).run(connection), MusicSettingsModel.class);
if (guildMusicSettings != null) {
String setId = guildMusicSettings.getChannel_id();
if (setId.equalsIgnoreCase("none"))
id = null;
else
id = setId;
} else {
id = null;
r.db("data").table("music_settings").insert(r.json(getStaticGson().toJson(new MusicSettingsModel(guild.getId(), false, "none")))).run(connection);
}
if (id == null || id.length() < 5)
return null;
else
return guild.getTextChannelById(id);
}
use of tk.ardentbot.rethink.models.MusicSettingsModel in project Ardent by adamint.
the class ArdentMusicManager method setChannel.
public void setChannel(MessageChannel channel) {
assert channel != null;
this.channel = channel.getId();
MusicSettingsModel guildMusicSettings = BaseCommand.asPojo(r.db("data").table("music_settings").get(((TextChannel) channel).getGuild().getId()).run(connection), MusicSettingsModel.class);
shouldAnnounce = !(guildMusicSettings == null || !guildMusicSettings.announce_music);
}
use of tk.ardentbot.rethink.models.MusicSettingsModel in project Ardent by adamint.
the class Music method shouldDeleteMessages.
static boolean shouldDeleteMessages(Guild guild) throws SQLException {
boolean returnValue = false;
MusicSettingsModel musicSettingsModel = asPojo(r.db("data").table("music_settings").get(guild.getId()).run(connection), MusicSettingsModel.class);
if (musicSettingsModel != null) {
if (musicSettingsModel.isRemove_addition_messages())
returnValue = true;
}
return returnValue;
}
use of tk.ardentbot.rethink.models.MusicSettingsModel in project Ardent by adamint.
the class MusicConfig method noArgs.
@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
Cursor<HashMap> settings = r.db("data").table("music_settings").filter(row -> row.g("guild_id").eq(guild.getId())).run(connection);
if (settings.hasNext()) {
MusicSettingsModel musicSettingsModel = asPojo(settings.next(), MusicSettingsModel.class);
sendTranslatedMessage("**music Settings**\n" + "Delete music play messages: " + musicSettingsModel.isRemove_addition_messages(), channel, user);
} else
sendTranslatedMessage("Your guild has no set music settings! Type **/manage** to find your portal" + " link", channel, user);
}
Aggregations