From 06c3abc28365b0f070aed6994b9f641542971b0e Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 22 Feb 2020 21:12:06 +0100 Subject: [PATCH 01/41] Fix --- src/main/java/com/bbn/hadder/core/Config.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/bbn/hadder/core/Config.java b/src/main/java/com/bbn/hadder/core/Config.java index b8fc4cf..fc5fff7 100644 --- a/src/main/java/com/bbn/hadder/core/Config.java +++ b/src/main/java/com/bbn/hadder/core/Config.java @@ -76,10 +76,10 @@ public class Config { .key("DiscordBestBots").value(null) .key("DiscordBoats").value(null) .key("YetAnotherBotList").value(null) - .value("DiscordExtremeList").value(null) - .value("DiscordBotReviews").value(null) - .value("DiscordBots").value(null) - .value("BotListSpace").value(null) + .key("DiscordExtremeList").value(null) + .key("DiscordBotReviews").value(null) + .key("DiscordBots").value(null) + .key("BotListSpace").value(null) .endObject().endObject().toString(); } From 8f642f44a954478148c4ad276a9b26812d2a9528 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 22 Feb 2020 21:14:08 +0100 Subject: [PATCH 02/41] Not needed --- src/main/java/com/bbn/hadder/core/Config.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/bbn/hadder/core/Config.java b/src/main/java/com/bbn/hadder/core/Config.java index fc5fff7..8eda9f6 100644 --- a/src/main/java/com/bbn/hadder/core/Config.java +++ b/src/main/java/com/bbn/hadder/core/Config.java @@ -142,11 +142,7 @@ public class Config { public String getDiscordExtremeListToken() { return config.getJSONObject("Tokens").getString("DiscordExtremeList"); } - - public String getDiscordBotReviewsToken() { - return config.getJSONObject("Tokens").getString("DiscordBotReviews"); - } - + public String getDiscordBotsToken() { return config.getJSONObject("Tokens").getString("DiscordBots"); } From 7519b7724f5101d145b184188e7a24e81a3206a7 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 22 Feb 2020 21:24:20 +0100 Subject: [PATCH 03/41] update invite perms --- .../java/com/bbn/hadder/commands/general/InviteCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java b/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java index 6127fce..7338876 100644 --- a/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java +++ b/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java @@ -33,7 +33,7 @@ public class InviteCommand implements Command { "commands.general.invite.success.description", "(https://discordapp.com/oauth2/authorize?client_id=" + Hadder.shardManager.getGuilds().get(0).getSelfMember().getId() - + "&scope=bot&permissions=470133879)") + + "&scope=bot&permissions=1043852663)") .build()).queue(); } From 85611bf0693c927ba81958ad5bca1ca7a59eecc0 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 22 Feb 2020 21:24:24 +0100 Subject: [PATCH 04/41] idk --- src/main/java/com/bbn/hadder/core/Config.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/core/Config.java b/src/main/java/com/bbn/hadder/core/Config.java index 8eda9f6..63ef2f9 100644 --- a/src/main/java/com/bbn/hadder/core/Config.java +++ b/src/main/java/com/bbn/hadder/core/Config.java @@ -142,7 +142,7 @@ public class Config { public String getDiscordExtremeListToken() { return config.getJSONObject("Tokens").getString("DiscordExtremeList"); } - + public String getDiscordBotsToken() { return config.getJSONObject("Tokens").getString("DiscordBots"); } From 586ce7b15131e1765274a47abce792525b917a50 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 22 Feb 2020 21:25:11 +0100 Subject: [PATCH 05/41] Uhm --- .../java/com/bbn/hadder/commands/general/InviteCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java b/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java index 7338876..68e3f68 100644 --- a/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java +++ b/src/main/java/com/bbn/hadder/commands/general/InviteCommand.java @@ -16,7 +16,6 @@ package com.bbn.hadder.commands.general; -import com.bbn.hadder.Hadder; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.utils.MessageEditor; @@ -32,7 +31,7 @@ public class InviteCommand implements Command { "", "commands.general.invite.success.description", "(https://discordapp.com/oauth2/authorize?client_id=" - + Hadder.shardManager.getGuilds().get(0).getSelfMember().getId() + + e.getJDA().getSelfUser().getId() + "&scope=bot&permissions=1043852663)") .build()).queue(); } From d0d75bfaf7ad7f46a7ed8e72b168eb956ad4318e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2020 19:40:10 +0000 Subject: [PATCH 06/41] Bump github-api from 1.106 to 1.107 Bumps github-api from 1.106 to 1.107. 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 42ab70c..97fd525 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ org.kohsuke github-api - 1.106 + 1.107 com.sedmelluq From 3d010c42cf70024b7cd70716a8cbf2a36479efe9 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 20:47:45 +0100 Subject: [PATCH 07/41] Bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 97fd525..a56b160 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Hadder Hadder - 1.1.0 + 1.1.1 Hadder From ca0f0f5693852656d33c7a680dcc4db15a3f9ba3 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 20:53:06 +0100 Subject: [PATCH 08/41] Update a lot of config stuff --- src/main/java/com/bbn/hadder/core/Config.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bbn/hadder/core/Config.java b/src/main/java/com/bbn/hadder/core/Config.java index 63ef2f9..2af7ff2 100644 --- a/src/main/java/com/bbn/hadder/core/Config.java +++ b/src/main/java/com/bbn/hadder/core/Config.java @@ -70,17 +70,22 @@ public class Config { .key("Tokens").object() .key("BotToken").value(null) .key("Giphy").value(null) + .key("GitHub").value(null) .key("MythicalBotList").value(null) .key("BotsForDiscord").value(null) .key("DiscordBotList").value(null) - .key("DiscordBestBots").value(null) .key("DiscordBoats").value(null) .key("YetAnotherBotList").value(null) .key("DiscordExtremeList").value(null) .key("DiscordBotReviews").value(null) .key("DiscordBots").value(null) .key("BotListSpace").value(null) - .endObject().endObject().toString(); + .key("DiscordBots2").value(null) + .key("CloudList").value(null) + .key("Arcane").value(null) + .endObject() + .key("Clyde").value("Clyde") + .endObject().toString(); } public String getBotToken() { @@ -159,6 +164,10 @@ public class Config { return config.getJSONObject("Tokens").getString("CloudList"); } + public String getArcaneToken() { + return config.getJSONObject("Tokens").getString("Arcane"); + } + public String getClydeName() { return config.getString("Clyde"); } From 431ecf8a673fcb90a796458b4adab041478c4878 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 20:55:46 +0100 Subject: [PATCH 09/41] Add a new bot list --- src/main/java/com/bbn/hadder/utils/BotList.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/bbn/hadder/utils/BotList.java b/src/main/java/com/bbn/hadder/utils/BotList.java index cf5890b..3abfe8d 100644 --- a/src/main/java/com/bbn/hadder/utils/BotList.java +++ b/src/main/java/com/bbn/hadder/utils/BotList.java @@ -40,6 +40,7 @@ public class BotList { private static String BotListSpace = "https://api.botlist.space/v1/bots/637002314162372639"; private static String DiscordBots2 = "https://discord.bots.gg/api/v1/bots/637002314162372639/stats"; private static String CloudList = "https://www.cloudlist.xyz/api/stats/637002314162372639"; + private static String ArcaneBotCenter = "https://arcane-botcenter.xyz/api/637002314162372639/stats"; private Config config; @@ -57,6 +58,7 @@ public class BotList { json.put("users", Hadder.shardManager.getUsers().size()); json.put("shard_count", Hadder.shardManager.getShards().size()); json.put("shardCount", Hadder.shardManager.getShards().size()); + json.put("member_count", Hadder.shardManager.getUsers().size()); RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString()); @@ -209,6 +211,21 @@ public class BotList { } catch (IOException e) { e.printStackTrace(); } + + // Arcane Bot Center + + Request arcane = new Request.Builder() + .url(ArcaneBotCenter) + .post(body) + .addHeader("Authorization", config.getArcaneToken()) + .build(); + + try { + new OkHttpClient().newCall(arcane).execute().close(); + System.out.println("Successfully posted count to the Arcane Bot Center!"); + } catch (IOException e) { + e.printStackTrace(); + } } } } From 6963935348b842484eac6969b556d3f69bbc7e36 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 21:09:27 +0100 Subject: [PATCH 10/41] Add pom description --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a56b160..fd93186 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,8 @@ Hadder Hadder 1.1.1 - Hadder + Hadder is a multi-purpose Discord bot. UTF-8 From 56712881556d56622bfb7c9a8a6412f5526ea151 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 21:12:43 +0100 Subject: [PATCH 11/41] Add license and inception to pom --- pom.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pom.xml b/pom.xml index fd93186..d8d1693 100644 --- a/pom.xml +++ b/pom.xml @@ -7,8 +7,17 @@ Hadder 1.1.1 Hadder + 2019 Hadder is a multi-purpose Discord bot. + + + GNU Affero General Public License v3.0 + https://www.gnu.org/licenses/agpl-3.0.en.html + repo + + + UTF-8 1.13 From a6fe1d419f0e871a44d0ed6399a8710f490836da Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sun, 23 Feb 2020 21:51:04 +0100 Subject: [PATCH 12/41] url yk --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index d8d1693..3602715 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,7 @@ Hadder 2019 Hadder is a multi-purpose Discord bot. + https://github.com/BigBotNetwork/Hadder From 3d47b3a0149faee06a7cb82bcf629b89d95eb7c1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2020 13:33:28 +0000 Subject: [PATCH 13/41] Bump JDA from 4.1.1_108 to 4.1.1_109 Bumps JDA from 4.1.1_108 to 4.1.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 3602715..62fcb5b 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ net.dv8tion JDA - 4.1.1_108 + 4.1.1_109 org.json From 25355681638f329af7b3bfa84c35964bae5c3ce3 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 26 Feb 2020 17:05:13 +0100 Subject: [PATCH 14/41] Prevent error yk --- .../java/com/bbn/hadder/commands/moderation/RulesCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/commands/moderation/RulesCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/RulesCommand.java index 48d54d2..756c327 100644 --- a/src/main/java/com/bbn/hadder/commands/moderation/RulesCommand.java +++ b/src/main/java/com/bbn/hadder/commands/moderation/RulesCommand.java @@ -56,7 +56,7 @@ public class RulesCommand implements Command { try { TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0); createRules(e, e1, channel); - } catch (NullPointerException ex) { + } catch (NullPointerException | IndexOutOfBoundsException ex) { e.getTextChannel().sendMessage( e.getMessageEditor().getMessage( MessageEditor.MessageType.ERROR, From 6c23b8c9bb34d14c2a191055f7c2d0d1de1dd026 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 13:21:18 +0000 Subject: [PATCH 15/41] Bump JDA from 4.1.1_109 to 4.1.1_110 Bumps JDA from 4.1.1_109 to 4.1.1_110. 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 62fcb5b..2c19aa3 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ net.dv8tion JDA - 4.1.1_109 + 4.1.1_110 org.json From 72cbcc18f7202e1de6697d88535258a4fde81ece Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2020 13:33:07 +0000 Subject: [PATCH 16/41] Bump jackson-annotations from 2.10.2 to 2.10.3 Bumps [jackson-annotations](https://github.com/FasterXML/jackson) from 2.10.2 to 2.10.3. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) 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 2c19aa3..0e927f3 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ com.fasterxml.jackson.core jackson-annotations - 2.10.2 + 2.10.3 From 01fa3085bc1f34d04580b5abd3b81e886a363043 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2020 13:18:45 +0000 Subject: [PATCH 17/41] Bump rethinkdb-driver from 2.4.0 to 2.4.1 Bumps [rethinkdb-driver](https://github.com/rethinkdb/rethinkdb-java) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/rethinkdb/rethinkdb-java/releases) - [Commits](https://github.com/rethinkdb/rethinkdb-java/commits) 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 0e927f3..17b2756 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.rethinkdb rethinkdb-driver - 2.4.0 + 2.4.1 org.slf4j From eadf88e6b86fd1b2aafee116a50b5a4385cce307 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2020 13:19:50 +0000 Subject: [PATCH 18/41] Bump github-api from 1.107 to 1.108 Bumps [github-api](https://github.com/github-api/github-api) from 1.107 to 1.108. - [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.107...github-api-1.108) 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 17b2756..85b0945 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ org.kohsuke github-api - 1.107 + 1.108 com.sedmelluq From 08e3948db3c2b5edb450acce1c5024205edda881 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2020 13:20:14 +0000 Subject: [PATCH 19/41] Bump rethinkdb-driver from 2.4.1 to 2.4.1.1 Bumps [rethinkdb-driver](https://github.com/rethinkdb/rethinkdb-java) from 2.4.1 to 2.4.1.1. - [Release notes](https://github.com/rethinkdb/rethinkdb-java/releases) - [Commits](https://github.com/rethinkdb/rethinkdb-java/compare/v2.4.1...v2.4.1.1) 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 17b2756..ba71b4e 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.rethinkdb rethinkdb-driver - 2.4.1 + 2.4.1.1 org.slf4j From 6489ad6cc5024c4c380812f5960436bfb05716d3 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Thu, 5 Mar 2020 17:01:06 +0100 Subject: [PATCH 20/41] Fix --- src/main/java/com/bbn/hadder/Rethink.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index aeaaf58..d1e3c3f 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -53,7 +53,7 @@ public class Rethink { private JSONArray getAsArray(String table, String where, String value) { try { - String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn); + String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn).toString(); return new JSONArray(string); } catch (NoSuchElementException e) { return null; @@ -77,7 +77,7 @@ public class Rethink { } public JSONObject getObjectByID(String table, String id) { - String response = r.table(table).get(id).toJson().run(conn); + String response = r.table(table).get(id).toJson().run(conn).toString(); return new JSONObject(response); } From 081da47b7119204347ab1666702037fb24ba968b Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 9 Mar 2020 19:10:15 +0100 Subject: [PATCH 21/41] IMPORTANT --- src/main/java/com/bbn/hadder/audio/AudioManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/audio/AudioManager.java b/src/main/java/com/bbn/hadder/audio/AudioManager.java index 363581c..512f460 100644 --- a/src/main/java/com/bbn/hadder/audio/AudioManager.java +++ b/src/main/java/com/bbn/hadder/audio/AudioManager.java @@ -162,5 +162,4 @@ public class AudioManager { s = s - (minutes * 60); return (hours == 0 ? "" : hours + ":") + String.format("%02d", minutes) + ":" + String.format("%02d", s); } - } From 5cc7acfe0dc12b845dd73ce3e2b3a73dbaffe966 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 9 Mar 2020 19:20:21 +0100 Subject: [PATCH 22/41] Mention Listener fix --- src/main/java/com/bbn/hadder/listener/MentionListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/listener/MentionListener.java b/src/main/java/com/bbn/hadder/listener/MentionListener.java index 276a02f..7fb9e11 100644 --- a/src/main/java/com/bbn/hadder/listener/MentionListener.java +++ b/src/main/java/com/bbn/hadder/listener/MentionListener.java @@ -50,7 +50,7 @@ public class MentionListener extends ListenerAdapter { MavenXpp3Reader reader = new MavenXpp3Reader(); Model model = null; try { - model = reader.read(this.getClass().getClassLoader().getResourceAsStream("pom.xml")); + model = reader.read(getClass().getResourceAsStream("pom.xml")); } catch (IOException | XmlPullParserException ex) { ex.printStackTrace(); } From c12e4e8e7c61a18c3a11ecb344e87bfb3d05584e Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 9 Mar 2020 19:20:26 +0100 Subject: [PATCH 23/41] more --- src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java | 4 +--- .../java/com/bbn/hadder/commands/misc/GitHubCommand.java | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java b/src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java index 29e01e4..50f2bcf 100644 --- a/src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java +++ b/src/main/java/com/bbn/hadder/commands/fun/ClydeCommand.java @@ -66,9 +66,7 @@ public class ClydeCommand implements Command { } webhook.delete().queue(); e.getMessage().delete().queue(); - } else { - e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue(); - } + } else e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_SELF_PERMISSION).build()).queue(); } else e.getHelpCommand().sendHelp(this, e); } diff --git a/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java b/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java index 606c9bb..fa9ad54 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java @@ -54,12 +54,10 @@ public class GitHubCommand implements Command { String website = "None"; try { bio = json.getString("bio"); - } catch (JSONException ignored) { - } + } catch (JSONException ignored) {} try { location = json.getString("location"); - } catch (JSONException ignored) { - } + } catch (JSONException ignored) {} if (!json.getString("blog").equals("")) website = json.getString("blog"); From e72560450088c66d73642d464486d29ff7b93768 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 9 Mar 2020 19:22:53 +0100 Subject: [PATCH 24/41] Version bump --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8cb9b8d..45289ec 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 Hadder Hadder - 1.1.1 + 1.1.3 Hadder 2019 Hadder is a multi-purpose Discord bot. From 4e6842bcd352fd72822d361601f0a4f10082a932 Mon Sep 17 00:00:00 2001 From: Skidder Date: Mon, 9 Mar 2020 19:26:53 +0100 Subject: [PATCH 25/41] Revert "v1.1.2" --- pom.xml | 4 ++-- src/main/java/com/bbn/hadder/Rethink.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 8cb9b8d..0e927f3 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.rethinkdb rethinkdb-driver - 2.4.1.1 + 2.4.0 org.slf4j @@ -91,7 +91,7 @@ org.kohsuke github-api - 1.108 + 1.107 com.sedmelluq diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index d1e3c3f..aeaaf58 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -53,7 +53,7 @@ public class Rethink { private JSONArray getAsArray(String table, String where, String value) { try { - String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn).toString(); + String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn); return new JSONArray(string); } catch (NoSuchElementException e) { return null; @@ -77,7 +77,7 @@ public class Rethink { } public JSONObject getObjectByID(String table, String id) { - String response = r.table(table).get(id).toJson().run(conn).toString(); + String response = r.table(table).get(id).toJson().run(conn); return new JSONObject(response); } From 841821abe3af7e450073d88a77fc4a7e114518c6 Mon Sep 17 00:00:00 2001 From: Skidder Date: Mon, 9 Mar 2020 19:31:05 +0100 Subject: [PATCH 26/41] Revert "Revert "v1.1.2"" --- pom.xml | 4 ++-- src/main/java/com/bbn/hadder/Rethink.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 0e927f3..8cb9b8d 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.rethinkdb rethinkdb-driver - 2.4.0 + 2.4.1.1 org.slf4j @@ -91,7 +91,7 @@ org.kohsuke github-api - 1.107 + 1.108 com.sedmelluq diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index aeaaf58..d1e3c3f 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -53,7 +53,7 @@ public class Rethink { private JSONArray getAsArray(String table, String where, String value) { try { - String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn); + String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn).toString(); return new JSONArray(string); } catch (NoSuchElementException e) { return null; @@ -77,7 +77,7 @@ public class Rethink { } public JSONObject getObjectByID(String table, String id) { - String response = r.table(table).get(id).toJson().run(conn); + String response = r.table(table).get(id).toJson().run(conn).toString(); return new JSONObject(response); } From 304c588dbb6805ee244e3d6c00c55a231dc6f74f Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Mon, 9 Mar 2020 20:05:47 +0100 Subject: [PATCH 27/41] Fix --- pom.xml | 2 +- src/main/java/com/bbn/hadder/Rethink.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 45289ec..c77db22 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ com.rethinkdb rethinkdb-driver - 2.4.1.1 + 2.4.0 org.slf4j diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index d1e3c3f..aeaaf58 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -53,7 +53,7 @@ public class Rethink { private JSONArray getAsArray(String table, String where, String value) { try { - String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn).toString(); + String string = r.table(table).filter(row -> row.g(where.toLowerCase()).eq(value)).coerceTo("array").toJson().run(conn); return new JSONArray(string); } catch (NoSuchElementException e) { return null; @@ -77,7 +77,7 @@ public class Rethink { } public JSONObject getObjectByID(String table, String id) { - String response = r.table(table).get(id).toJson().run(conn).toString(); + String response = r.table(table).get(id).toJson().run(conn); return new JSONObject(response); } From e811da3aeb5f96bc036a1c318c8e5f5d5e14d129 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Tue, 10 Mar 2020 17:19:00 +0100 Subject: [PATCH 28/41] No permission improvement --- .../bbn/hadder/listener/CommandListener.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/bbn/hadder/listener/CommandListener.java b/src/main/java/com/bbn/hadder/listener/CommandListener.java index aeb8615..286d320 100644 --- a/src/main/java/com/bbn/hadder/listener/CommandListener.java +++ b/src/main/java/com/bbn/hadder/listener/CommandListener.java @@ -25,6 +25,7 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.ChannelType; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; +import net.dv8tion.jda.api.exceptions.ErrorResponseException; import net.dv8tion.jda.api.hooks.ListenerAdapter; import java.awt.*; @@ -64,13 +65,17 @@ public class CommandListener extends ListenerAdapter { } } } else { - e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder() - .setTitle("No permission") - .setDescription("I need the `MESSAGE EMBED LINKS` permission in order to work!") - .setColor(Color.RED) - .setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png") - .setTimestamp(Instant.now()) - .build()).queue(); + try { + e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder() + .setTitle("No permission") + .setDescription("I need the `MESSAGE EMBED LINKS` permission in order to work!") + .setColor(Color.RED) + .setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png") + .setTimestamp(Instant.now()) + .build()).queue(); + } catch (ErrorResponseException ex) { + e.getTextChannel().sendMessage("I need the `MESSAGE EMBED LINKS` permission in order to work!").queue(); + } } } else { e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder() From 55977585ac04bee3155662b1e11918b2e470942d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2020 13:18:39 +0000 Subject: [PATCH 29/41] Bump maven-site-plugin from 3.8.2 to 3.9.0 Bumps [maven-site-plugin](https://github.com/apache/maven-site-plugin) from 3.8.2 to 3.9.0. - [Release notes](https://github.com/apache/maven-site-plugin/releases) - [Commits](https://github.com/apache/maven-site-plugin/compare/maven-site-plugin-3.8.2...maven-site-plugin-3.9.0) 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 c77db22..7137793 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ maven-site-plugin - 3.8.2 + 3.9.0 maven-project-info-reports-plugin From 71bfe01285714012885ec6850f3c2d1980c1da04 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2020 13:17:35 +0000 Subject: [PATCH 30/41] Bump JDA from 4.1.1_110 to 4.1.1_111 Bumps JDA from 4.1.1_110 to 4.1.1_111. 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 7137793..5cb7ed4 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ net.dv8tion JDA - 4.1.1_110 + 4.1.1_111 org.json From ba9672f87da3966f0ecaa3179ff8d37600dcce50 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2020 13:17:03 +0000 Subject: [PATCH 31/41] Bump JDA from 4.1.1_111 to 4.1.1_113 Bumps JDA from 4.1.1_111 to 4.1.1_113. 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 5cb7ed4..8fc48d9 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ net.dv8tion JDA - 4.1.1_111 + 4.1.1_113 org.json From 35f932c3773c95fcd70117fb77362a4c184d347e Mon Sep 17 00:00:00 2001 From: Schlauer-Hax Date: Fri, 13 Mar 2020 21:44:01 +0100 Subject: [PATCH 32/41] moveall command --- src/main/java/com/bbn/hadder/Hadder.java | 3 +- .../hadder/commands/misc/MoveAllCommand.java | 50 +++++++++++++++++++ src/main/java/com/bbn/hadder/core/Perm.java | 22 +++++--- 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index 57a7cb0..0d93dd7 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -126,7 +126,8 @@ public class Hadder { new EchoCommand(), new ServerStatsCommand(), new ProfileCommand(), - new CodeCommand()), config, helpCommand); + new CodeCommand(), + new MoveAllCommand()), config, helpCommand); builder.addEventListeners( new MentionListener(rethink), diff --git a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java new file mode 100644 index 0000000..5d26277 --- /dev/null +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -0,0 +1,50 @@ +/* + * @author Hax / Hax6775 / Schlauer_Hax + */ + +package com.bbn.hadder.commands.misc; + +import com.bbn.hadder.commands.Command; +import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.core.Perm; +import com.bbn.hadder.core.Perms; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Member; + +import java.util.ArrayList; +import java.util.Objects; + +public class MoveAllCommand implements Command { + + @Perms(Perm.VOICE_MOVE_OTHERS) + @Override + public void executed(String[] args, CommandEvent e) { + if (args.length == 2) { + Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().forEach( + member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue() + ); + } else { + e.getHelpCommand().sendHelp(this, e); + } + } + + @Override + public String[] labels() { + return new String[]{"moveall", "move-all"}; + } + + @Override + public String description() { + return "Moves All users in channel1 to channel2"; + } + + @Override + public String usage() { + return "[channel1] [channel2]"; + } + + @Override + public String example() { + return "452806287307046923 452858405212782623"; + } +} diff --git a/src/main/java/com/bbn/hadder/core/Perm.java b/src/main/java/com/bbn/hadder/core/Perm.java index 0eea910..2c5b4bb 100644 --- a/src/main/java/com/bbn/hadder/core/Perm.java +++ b/src/main/java/com/bbn/hadder/core/Perm.java @@ -26,54 +26,60 @@ public enum Perm { public boolean check(CommandEvent e) { return e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, MANAGE_MESSAGES { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.MESSAGE_MANAGE) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, BAN_MEMBERS { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.BAN_MEMBERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, KICK_MEMBERS { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.KICK_MEMBERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, MANAGE_SERVER { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.MANAGE_SERVER) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, MANAGE_ROLES { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.MANAGE_ROLES) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, MANAGE_NICKNAMES { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.NICKNAME_MANAGE) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, ADMINISTRATOR { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.ADMINISTRATOR) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } - }, + }, MANAGE_WEBHOOKS { @Override public boolean check(CommandEvent e) { return e.getMember().hasPermission(Permission.MANAGE_WEBHOOKS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); } + }, + VOICE_MOVE_OTHERS { + @Override + public boolean check(CommandEvent e) { + return e.getMember().hasPermission(Permission.VOICE_MOVE_OTHERS) || e.getConfig().getOwners().contains(e.getAuthor().getIdLong()); + } }; public abstract boolean check(CommandEvent e); From 8b4926aab245ada31d87f21814d814b3667603f2 Mon Sep 17 00:00:00 2001 From: Schlauer-Hax Date: Fri, 13 Mar 2020 22:15:33 +0100 Subject: [PATCH 33/41] Fix --- .../java/com/bbn/hadder/commands/misc/MoveAllCommand.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 5d26277..90aa962 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -8,6 +8,7 @@ import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.core.Perm; import com.bbn.hadder.core.Perms; +import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Member; @@ -20,9 +21,14 @@ public class MoveAllCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { if (args.length == 2) { + int count = 0; Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().forEach( - member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue() + member -> { + e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue(); + } ); + e.getChannel().sendMessage(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + + Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().size() + " Members. Have fun!").build()).queue(); } else { e.getHelpCommand().sendHelp(this, e); } From fbbdb9f48813cf627d490f6c69bb37f0b11e367b Mon Sep 17 00:00:00 2001 From: Schlauer-Hax Date: Fri, 13 Mar 2020 22:15:54 +0100 Subject: [PATCH 34/41] a --- src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 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 90aa962..33684f0 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -21,13 +21,12 @@ public class MoveAllCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { if (args.length == 2) { - int count = 0; Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().forEach( member -> { e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue(); } ); - e.getChannel().sendMessage(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + + e.getChannel().sendMessage(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().size() + " Members. Have fun!").build()).queue(); } else { e.getHelpCommand().sendHelp(this, e); From e0df9cc7388d28cadbdd32d4e97d58120a47b5d6 Mon Sep 17 00:00:00 2001 From: Schlauer-Hax Date: Fri, 13 Mar 2020 22:16:33 +0100 Subject: [PATCH 35/41] aa --- src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 33684f0..bf8fc95 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -21,13 +21,14 @@ public class MoveAllCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { if (args.length == 2) { + int count = Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().size(); Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().forEach( member -> { e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue(); } ); e.getChannel().sendMessage(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + - Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().size() + " Members. Have fun!").build()).queue(); + count + " Members. Have fun!").build()).queue(); } else { e.getHelpCommand().sendHelp(this, e); } From e031eb1532217a8b406d59988f415fabbddb05a8 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 15:28:16 +0100 Subject: [PATCH 36/41] Fix help stuff --- .../hadder/commands/misc/MoveAllCommand.java | 27 ++++++++++++------- .../Translations/Translations_en.properties | 1 + 2 files changed, 18 insertions(+), 10 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 bf8fc95..d6e84f7 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -1,5 +1,17 @@ /* - * @author Hax / Hax6775 / Schlauer_Hax + * Copyright 2019-2020 GregTCLTK and Schlauer-Hax + * + * Licensed under the GNU Affero General Public License, Version 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.gnu.org/licenses/agpl-3.0.en.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.bbn.hadder.commands.misc; @@ -9,10 +21,7 @@ import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.core.Perm; import com.bbn.hadder.core.Perms; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.Member; -import java.util.ArrayList; import java.util.Objects; public class MoveAllCommand implements Command { @@ -29,24 +38,22 @@ public class MoveAllCommand implements Command { ); e.getChannel().sendMessage(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + count + " Members. Have fun!").build()).queue(); - } else { - e.getHelpCommand().sendHelp(this, e); - } + } else e.getHelpCommand().sendHelp(this, e); } @Override public String[] labels() { - return new String[]{"moveall", "move-all"}; + return new String[]{"moveall", "move-all", "ma"}; } @Override public String description() { - return "Moves All users in channel1 to channel2"; + return "commands.misc.moveall.help.description"; } @Override public String usage() { - return "[channel1] [channel2]"; + return "[source-channel] [target-channel]"; } @Override diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 01d2f6e..0ccc653 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -98,6 +98,7 @@ commands.misc.code.success.description = This message contains some information commands.misc.code.error.title = Code not found 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.help.description = Moves all users in the source channel to the target channel. commands.moderation.ban.success.title = Successfully banned commands.moderation.ban.success.description = I successfully baned %extra% From 8de3748f1a8864f2c2c29c977f97a41b3c642d98 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 15:35:27 +0100 Subject: [PATCH 37/41] i18n stuff --- .../hadder/commands/misc/MoveAllCommand.java | 20 +++++++++---------- .../Translations/Translations_en.properties | 2 ++ 2 files changed, 11 insertions(+), 11 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 d6e84f7..8746c3c 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -20,24 +20,22 @@ import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.core.Perm; import com.bbn.hadder.core.Perms; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.util.Objects; +import com.bbn.hadder.utils.MessageEditor; +@Perms(Perm.VOICE_MOVE_OTHERS) public class MoveAllCommand implements Command { - @Perms(Perm.VOICE_MOVE_OTHERS) @Override public void executed(String[] args, CommandEvent e) { if (args.length == 2) { - int count = Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().size(); - Objects.requireNonNull(e.getGuild().getVoiceChannelById(args[0])).getMembers().forEach( - member -> { - e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue(); - } + 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(new EmbedBuilder().setTitle("Successfully Moved!").setDescription("I moved " + - count + " Members. Have fun!").build()).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.getHelpCommand().sendHelp(this, e); } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 0ccc653..e818bc3 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -98,6 +98,8 @@ commands.misc.code.success.description = This message contains some information commands.misc.code.error.title = Code not found 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.help.description = Moves all users in the source channel to the target channel. commands.moderation.ban.success.title = Successfully banned From 39cef6b5fdcda09f57ebd6c4ea5e6ab87eff62c8 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 15:51:48 +0100 Subject: [PATCH 38/41] Remove a line lol --- src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java | 1 - 1 file changed, 1 deletion(-) 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 8746c3c..519e681 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/MoveAllCommand.java @@ -15,7 +15,6 @@ */ package com.bbn.hadder.commands.misc; - import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.core.Perm; From b4a25bfc97c573d7cd2b89e4ae1013a81d0bb7e7 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 15:53:09 +0100 Subject: [PATCH 39/41] covid command --- src/main/java/com/bbn/hadder/Hadder.java | 3 +- .../hadder/commands/misc/CoronaCommand.java | 48 +++++++++++++++++++ .../Translations/Translations_en.properties | 1 + 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index 0d93dd7..99f9b3d 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -127,7 +127,8 @@ public class Hadder { new ServerStatsCommand(), new ProfileCommand(), new CodeCommand(), - new MoveAllCommand()), config, helpCommand); + new MoveAllCommand(), + new CoronaCommand()), config, helpCommand); builder.addEventListeners( new MentionListener(rethink), diff --git a/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java new file mode 100644 index 0000000..3235fa3 --- /dev/null +++ b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019-2020 GregTCLTK and Schlauer-Hax + * + * Licensed under the GNU Affero General Public License, Version 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.gnu.org/licenses/agpl-3.0.en.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.bbn.hadder.commands.misc; + +import com.bbn.hadder.commands.Command; +import com.bbn.hadder.commands.CommandEvent; + +public class CoronaCommand implements Command { + + @Override + public void executed(String[] args, CommandEvent e) { + + } + + @Override + public String[] labels() { + return new String[]{"corona"}; + } + + @Override + public String description() { + return "commands.misc.corona.help.description"; + } + + @Override + public String usage() { + return null; + } + + @Override + public String example() { + return null; + } +} diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index e818bc3..f967f19 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -101,6 +101,7 @@ 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.help.description = Moves all users in the source channel to the target channel. +commands.misc.corona.help.description = Show the newest stats about COVID-19 commands.moderation.ban.success.title = Successfully banned commands.moderation.ban.success.description = I successfully baned %extra% From 36994799bd2aa04670bf47bf536385227c308c06 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 16:19:13 +0100 Subject: [PATCH 40/41] Finish it --- .../hadder/commands/misc/CoronaCommand.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java index 3235fa3..4f47da5 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java @@ -18,12 +18,33 @@ package com.bbn.hadder.commands.misc; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.utils.MessageEditor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.json.JSONObject; + +import java.io.IOException; public class CoronaCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { + OkHttpClient client = new OkHttpClient(); + Request request = new Request.Builder().url("https://api.covid.stream/latest/numbers").build(); + try { + Response response = client.newCall(request).execute(); + JSONObject json = new JSONObject(response.body().string()).getJSONObject("data"); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("`Confirmed cases:` **").append(json.get("totalConfirmedNumber")).append("**\n").append("`Deaths:` **").append(json.get("totalDeathNumbers")).append("** \n").append("`Recovered:`" ).append("** \n"); + e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setDescription(stringBuilder).build()).queue(); + } catch (IOException ex) { + e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR) + .setTitle("API Error") + .setDescription("Try again later!") + .build()).queue(); + } } @Override From b8cf0cfe054442233fbedbfb87c478a0c4dc3e80 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 14 Mar 2020 16:22:06 +0100 Subject: [PATCH 41/41] Fix --- src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java index 4f47da5..3f24ea5 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/CoronaCommand.java @@ -37,7 +37,7 @@ public class CoronaCommand implements Command { Response response = client.newCall(request).execute(); JSONObject json = new JSONObject(response.body().string()).getJSONObject("data"); StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("`Confirmed cases:` **").append(json.get("totalConfirmedNumber")).append("**\n").append("`Deaths:` **").append(json.get("totalDeathNumbers")).append("** \n").append("`Recovered:`" ).append("** \n"); + stringBuilder.append("`Confirmed cases:` **").append(json.get("totalConfirmedNumbers")).append("**\n").append("`Deaths:` **").append(json.get("totalDeathNumbers")).append("** \n").append("`Recovered:` **").append(json.get("totalRecoveredNumbers")).append("** \n"); e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO).setDescription(stringBuilder).build()).queue(); } catch (IOException ex) { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR)