From 231ca28b225a6f236cf5577235ff872e2256b79e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2020 13:19:24 +0000 Subject: [PATCH 1/9] Bump lavaplayer from 1.3.40 to 1.3.41 Bumps lavaplayer from 1.3.40 to 1.3.41. Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0460e6c..471ec89 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ com.sedmelluq lavaplayer - 1.3.40 + 1.3.41 com.fasterxml.jackson.core From 0282ada6dc71a0632a01a25f67a0e34fae718f13 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2020 13:19:05 +0000 Subject: [PATCH 2/9] Bump lavaplayer from 1.3.41 to 1.3.42 Bumps lavaplayer from 1.3.41 to 1.3.42. Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 471ec89..7f8bcb6 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ com.sedmelluq lavaplayer - 1.3.41 + 1.3.42 com.fasterxml.jackson.core From bd8cc488182816f0e0971710b21ec39dd42c66f2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2020 13:19:33 +0000 Subject: [PATCH 3/9] Bump github-api from 1.108 to 1.109 Bumps [github-api](https://github.com/github-api/github-api) from 1.108 to 1.109. - [Release notes](https://github.com/github-api/github-api/releases) - [Changelog](https://github.com/github-api/github-api/blob/master/CHANGELOG.md) - [Commits](https://github.com/github-api/github-api/compare/github-api-1.108...github-api-1.109) Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 471ec89..1edef19 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ org.kohsuke github-api - 1.108 + 1.109 com.sedmelluq From c6f2db6e5440ddb8b9d7ddef1ba5a767e9900b1f Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Fri, 3 Apr 2020 13:00:06 +0200 Subject: [PATCH 4/9] Add member count to the code command --- src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java b/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java index a154bb2..9f22e89 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/CodeCommand.java @@ -31,7 +31,7 @@ public class CodeCommand implements Command { public void executed(String[] args, CommandEvent e) { if (args.length > 0) { OkHttpClient client = new OkHttpClient(); - Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invite/" + args[0]).addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build(); + Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invite/" + args[0] + "?with_counts=true").addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build(); try { Response response = client.newCall(request).execute(); @@ -45,6 +45,9 @@ public class CodeCommand implements Command { .addField("Verification Level", String.valueOf(json.getJSONObject("guild").getInt("verification_level")), true) .addField("Guild ID", json.getJSONObject("guild").getString("id"), true) .addBlankField(true) + .addField("Members", String.valueOf(json.get("approximate_member_count")), true) + .addBlankField(true) + .addBlankField(true) .setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png") .build()).queue(); } catch (JSONException ex) { From 8b7d07b9881643e483d4c998d8fa32240aca5075 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2020 13:18:59 +0000 Subject: [PATCH 5/9] Bump lavaplayer from 1.3.42 to 1.3.43 Bumps lavaplayer from 1.3.42 to 1.3.43. Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e9d8820..7d493dd 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ com.sedmelluq lavaplayer - 1.3.42 + 1.3.43 com.fasterxml.jackson.core From aa0637d237cf1b7ec8bb25b94e73df84db97ddae Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:19:41 +0000 Subject: [PATCH 6/9] Bump lavaplayer from 1.3.43 to 1.3.44 Bumps lavaplayer from 1.3.43 to 1.3.44. Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7d493dd..40268a8 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ com.sedmelluq lavaplayer - 1.3.43 + 1.3.44 com.fasterxml.jackson.core From 3a5dc59b037cf4779fc9926853392d388d824b31 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:20:07 +0000 Subject: [PATCH 7/9] Bump JDA from 4.1.1_127 to 4.1.1_131 Bumps JDA from 4.1.1_127 to 4.1.1_131. Signed-off-by: dependabot-preview[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7d493dd..dd1d6dc 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ net.dv8tion JDA - 4.1.1_127 + 4.1.1_131 org.json From 295e88a89a027b35ebc0bb340a89cdc58732b2b4 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 6 Apr 2020 19:57:59 +0200 Subject: [PATCH 8/9] Add error msg --- .../hadder/commands/misc/MoveAllCommand.java | 23 ++++++++++++------- .../Translations/Translations_en.properties | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java index b8d1dc6..3dbf7c0 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -30,14 +30,21 @@ public class MoveAllCommand implements Command { if (args.length == 2) { if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) { if (StringUtils.isNumeric(args[1]) && args[1].length() == 18) { - int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size(); - e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach( - member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue() - ); - e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, - "commands.misc.moveall.success.title", "", - "commands.misc.moveall.success.description", String.valueOf(count)) - .build()).queue(); + if (!args[0].equals(args[1])) { + int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size(); + e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach( + member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue() + ); + e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.misc.moveall.success.title", "", + "commands.misc.moveall.success.description", String.valueOf(count)) + .build()).queue(); + } else { + e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, + "commands.misc.moveall.error.equals.title", + "commands.misc.moveall.error.equals.description") + .build()).queue(); + } } else { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.misc.moveall.error.target.int.title", diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 98b2a88..4ae304a 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -100,6 +100,8 @@ commands.misc.code.error.description = I can't find the specified invite code. commands.misc.code.help.description = Shows information about a invite code. commands.misc.moveall.success.title = Successfully moved commands.misc.moveall.success.description = I successfully moved %extra% members. Have fun\! +commands.misc.moveall.error.equals.title = Not twice +commands.misc.moveall.error.equals.description = The first voice channel equals the second. You have to specify two different voice channels. commands.misc.moveall.error.source.int.title = Invalid ID commands.misc.moveall.error.source.int.description = You didn't specified a ID as the source channel. commands.misc.moveall.error.target.int.title = Invalid ID From 6ffb0a2d99333fd7754e8f434cbdcb1262a8af1b Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 6 Apr 2020 22:47:36 +0200 Subject: [PATCH 9/9] Implement bad fix --- src/main/java/com/bbn/hadder/Rethink.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index 6be8bdd..5f8ee59 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -22,6 +22,7 @@ import com.rethinkdb.gen.exc.ReqlNonExistenceError; import com.rethinkdb.gen.exc.ReqlOpFailedError; import com.rethinkdb.net.Connection; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import java.lang.reflect.Field; @@ -78,7 +79,12 @@ public class Rethink { public JSONObject getObjectByID(String table, String id) { String response = r.table(table).get(id).toJson().run(conn); - return new JSONObject(response); + try { + return new JSONObject(response); + } catch (JSONException e) { + System.out.println(response); + return null; + } } public void insert(String table, Object object) {