null
This commit is contained in:
parent
7daceb3cbe
commit
07b8749e0b
4 changed files with 18 additions and 12 deletions
|
|
@ -18,6 +18,7 @@ package com.bbn.hadder;
|
||||||
|
|
||||||
import com.bbn.hadder.core.Config;
|
import com.bbn.hadder.core.Config;
|
||||||
import com.rethinkdb.RethinkDB;
|
import com.rethinkdb.RethinkDB;
|
||||||
|
import com.rethinkdb.gen.exc.ReqlNonExistenceError;
|
||||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||||
import com.rethinkdb.net.Connection;
|
import com.rethinkdb.net.Connection;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
|
@ -125,10 +126,10 @@ public class Rethink {
|
||||||
this.insert("server", r
|
this.insert("server", r
|
||||||
.hashMap("id", id)
|
.hashMap("id", id)
|
||||||
.with("prefix", "h.")
|
.with("prefix", "h.")
|
||||||
.with("message_id", "")
|
.with("message_id", null)
|
||||||
.with("role_id", "")
|
.with("role_id", null)
|
||||||
.with("invite_detect", false)
|
.with("invite_detect", false)
|
||||||
.with("starboard", "")
|
.with("starboard", null)
|
||||||
.with("neededstars", "4")
|
.with("neededstars", "4")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +144,7 @@ public class Rethink {
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
public boolean hasStarboardChannel(String guild_id) {
|
public boolean hasStarboardChannel(String guild_id) {
|
||||||
return !this.getByID("server", guild_id, "starboard").equals("");
|
return this.getByID("server", guild_id, "starboard") != null;
|
||||||
}
|
}
|
||||||
// TODO
|
// TODO
|
||||||
public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) {
|
public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) {
|
||||||
|
|
@ -159,7 +160,12 @@ public class Rethink {
|
||||||
}
|
}
|
||||||
// TODO
|
// TODO
|
||||||
public boolean hasStarboardMessage(String message_id) {
|
public boolean hasStarboardMessage(String message_id) {
|
||||||
return this.getByID("stars", message_id, "guild") != null;
|
try {
|
||||||
|
this.getByID("stars", message_id, "guild");
|
||||||
|
return true;
|
||||||
|
} catch (ReqlNonExistenceError e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,15 @@ public class RethinkServer {
|
||||||
|
|
||||||
private Rethink rethink;
|
private Rethink rethink;
|
||||||
|
|
||||||
String accept_emote = "";
|
String accept_emote = null;
|
||||||
String decline_emote = "";
|
String decline_emote = null;
|
||||||
String id;
|
String id;
|
||||||
boolean invite_detect = false;
|
boolean invite_detect = false;
|
||||||
String message_id = "";
|
String message_id = null;
|
||||||
String neededstars = "3";
|
String neededstars = "3";
|
||||||
String prefix = "h.";
|
String prefix = "h.";
|
||||||
String role_id = "";
|
String role_id = null;
|
||||||
String starboard = "";
|
String starboard = null;
|
||||||
|
|
||||||
public RethinkServer(JSONObject object, Rethink rethink) {
|
public RethinkServer(JSONObject object, Rethink rethink) {
|
||||||
for (Field field : this.getClass().getDeclaredFields()) {
|
for (Field field : this.getClass().getDeclaredFields()) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class RethinkUser {
|
||||||
String id;
|
String id;
|
||||||
String prefix = "h.";
|
String prefix = "h.";
|
||||||
String language = "en";
|
String language = "en";
|
||||||
String blacklisted = "none";
|
String blacklisted = null;
|
||||||
|
|
||||||
public RethinkUser(JSONObject object, Rethink rethink) {
|
public RethinkUser(JSONObject object, Rethink rethink) {
|
||||||
for (Field field : this.getClass().getDeclaredFields()) {
|
for (Field field : this.getClass().getDeclaredFields()) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class CommandHandler {
|
||||||
|
|
||||||
boolean run = true;
|
boolean run = true;
|
||||||
String blacklisted = rethinkUser.getBlacklisted();
|
String blacklisted = rethinkUser.getBlacklisted();
|
||||||
if (!"none".equals(blacklisted)) {
|
if (!(null == blacklisted)) {
|
||||||
for (String BLLabel : blacklisted.split(",")) {
|
for (String BLLabel : blacklisted.split(",")) {
|
||||||
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
|
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
|
||||||
run = false;
|
run = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue