This commit is contained in:
GregTCLTK 2020-01-28 21:23:24 +01:00
parent 7daceb3cbe
commit 07b8749e0b
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
4 changed files with 18 additions and 12 deletions

View file

@ -18,6 +18,7 @@ package com.bbn.hadder;
import com.bbn.hadder.core.Config;
import com.rethinkdb.RethinkDB;
import com.rethinkdb.gen.exc.ReqlNonExistenceError;
import com.rethinkdb.gen.exc.ReqlOpFailedError;
import com.rethinkdb.net.Connection;
import org.json.JSONArray;
@ -125,10 +126,10 @@ public class Rethink {
this.insert("server", r
.hashMap("id", id)
.with("prefix", "h.")
.with("message_id", "")
.with("role_id", "")
.with("message_id", null)
.with("role_id", null)
.with("invite_detect", false)
.with("starboard", "")
.with("starboard", null)
.with("neededstars", "4")
);
}
@ -143,7 +144,7 @@ public class Rethink {
// TODO
public boolean hasStarboardChannel(String guild_id) {
return !this.getByID("server", guild_id, "starboard").equals("");
return this.getByID("server", guild_id, "starboard") != null;
}
// TODO
public void insertStarboardMessage(String message_id, String guild_id, String starboard_message_id) {
@ -159,7 +160,12 @@ public class Rethink {
}
// TODO
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;
}
}

View file

@ -24,15 +24,15 @@ public class RethinkServer {
private Rethink rethink;
String accept_emote = "";
String decline_emote = "";
String accept_emote = null;
String decline_emote = null;
String id;
boolean invite_detect = false;
String message_id = "";
String message_id = null;
String neededstars = "3";
String prefix = "h.";
String role_id = "";
String starboard = "";
String role_id = null;
String starboard = null;
public RethinkServer(JSONObject object, Rethink rethink) {
for (Field field : this.getClass().getDeclaredFields()) {

View file

@ -27,7 +27,7 @@ public class RethinkUser {
String id;
String prefix = "h.";
String language = "en";
String blacklisted = "none";
String blacklisted = null;
public RethinkUser(JSONObject object, Rethink rethink) {
for (Field field : this.getClass().getDeclaredFields()) {

View file

@ -69,7 +69,7 @@ public class CommandHandler {
boolean run = true;
String blacklisted = rethinkUser.getBlacklisted();
if (!"none".equals(blacklisted)) {
if (!(null == blacklisted)) {
for (String BLLabel : blacklisted.split(",")) {
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
run = false;