Sync with master #685

Merged
greg6775 merged 13 commits from master into greg-dev 2021-07-21 23:20:14 +02:00
2 changed files with 7 additions and 4 deletions
Showing only changes of commit 6c8b697455 - Show all commits

View file

@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>Hadder</groupId> <groupId>Hadder</groupId>
<artifactId>Hadder</artifactId> <artifactId>Hadder</artifactId>
<version>2.0.0</version> <version>2.0.1</version>
<name>Hadder</name> <name>Hadder</name>
<inceptionYear>2019</inceptionYear> <inceptionYear>2019</inceptionYear>
<description>Hadder is a multi-purpose Discord bot.</description> <description>Hadder is a multi-purpose Discord bot.</description>

View file

@ -43,7 +43,11 @@ public class Mongo {
BasicDBObject whereQuery = new BasicDBObject(); BasicDBObject whereQuery = new BasicDBObject();
whereQuery.put(where, what); whereQuery.put(where, what);
FindIterable<Document> it = collection.find(whereQuery); FindIterable<Document> it = collection.find(whereQuery);
try {
return it.cursor().next().get(column); return it.cursor().next().get(column);
} catch (NoSuchElementException ignore) {
return null;
}
} }
public JSONObject getObjectByID(String collection, String id) { public JSONObject getObjectByID(String collection, String id) {
@ -133,8 +137,7 @@ public class Mongo {
} }
public boolean hasStarboardMessage(String message_id) { public boolean hasStarboardMessage(String message_id) {
this.getByID("stars", "id", message_id, "guild"); return this.getByID("stars", "id", message_id, "guild") != null;
return true;
} }
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) {