Search in sources :

Example 1 with DefaultRoleModel

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;
}
Also used : DefaultRoleModel(tk.ardentbot.rethink.models.DefaultRoleModel) HashMap(java.util.HashMap) Cursor(com.rethinkdb.net.Cursor)

Aggregations

Cursor (com.rethinkdb.net.Cursor)1 HashMap (java.util.HashMap)1 DefaultRoleModel (tk.ardentbot.rethink.models.DefaultRoleModel)1