use of tk.ardentbot.rethink.models.DefaultRoleModel in project Ardent by adamint.
the class DefaultRole method getDefaultRole.
public static Role getDefaultRole(Guild guild) {
Role returned = null;
List<HashMap> defaultRoleModels = ((Cursor<HashMap>) r.db("data").table("defaultroles").filter(row -> row.g("guild_id").eq(guild.getId())).run(connection)).toList();
if (defaultRoleModels.size() > 0) {
DefaultRoleModel defaultRoleModel = asPojo(defaultRoleModels.get(0), DefaultRoleModel.class);
String roleID = defaultRoleModel.getRole_id();
if (!roleID.equalsIgnoreCase("none")) {
returned = guild.getRoleById(roleID);
}
}
return returned;
}
Aggregations