From 5181a4cc02bb5fbcf3846286a6779f143c8c728c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:21:48 +0000 Subject: [PATCH 01/23] Bump github-api from 1.103 to 1.105 Bumps github-api from 1.103 to 1.105. 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 ae33d40..20907bd 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ org.kohsuke github-api - 1.103 + 1.105 com.sedmelluq From b2cacd77e51dae9addbc2f17cb199d5ad8e63c83 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:22:13 +0000 Subject: [PATCH 02/23] Bump lavaplayer from 1.3.33 to 1.3.34 Bumps lavaplayer from 1.3.33 to 1.3.34. 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 ae33d40..15446cd 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ com.sedmelluq lavaplayer - 1.3.33 + 1.3.34 From 9b992b4886e607379ebfb5364852e247d66d0849 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:22:39 +0000 Subject: [PATCH 03/23] Bump JDA from 4.1.1_101 to 4.1.1_102 Bumps JDA from 4.1.1_101 to 4.1.1_102. 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 ae33d40..569b143 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ net.dv8tion JDA - 4.1.1_101 + 4.1.1_102 org.json From 2fcd7551615111254f7b907737737bc8623028d6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2020 13:34:38 +0000 Subject: [PATCH 04/23] Bump JDA from 4.1.1_102 to 4.1.1_103 Bumps JDA from 4.1.1_102 to 4.1.1_103. 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 50e66a1..7ad4d51 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ net.dv8tion JDA - 4.1.1_102 + 4.1.1_103 org.json From 07b8749e0b6fd514dfad22e86ba4461b416da0b5 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Tue, 28 Jan 2020 21:23:24 +0100 Subject: [PATCH 05/23] null --- src/main/java/com/bbn/hadder/Rethink.java | 16 +++++++++++----- src/main/java/com/bbn/hadder/RethinkServer.java | 10 +++++----- src/main/java/com/bbn/hadder/RethinkUser.java | 2 +- .../java/com/bbn/hadder/core/CommandHandler.java | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/bbn/hadder/Rethink.java b/src/main/java/com/bbn/hadder/Rethink.java index 6b2b137..2a14fac 100644 --- a/src/main/java/com/bbn/hadder/Rethink.java +++ b/src/main/java/com/bbn/hadder/Rethink.java @@ -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; + } } diff --git a/src/main/java/com/bbn/hadder/RethinkServer.java b/src/main/java/com/bbn/hadder/RethinkServer.java index c15c448..04b11ca 100644 --- a/src/main/java/com/bbn/hadder/RethinkServer.java +++ b/src/main/java/com/bbn/hadder/RethinkServer.java @@ -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()) { diff --git a/src/main/java/com/bbn/hadder/RethinkUser.java b/src/main/java/com/bbn/hadder/RethinkUser.java index 26376f5..eba7564 100644 --- a/src/main/java/com/bbn/hadder/RethinkUser.java +++ b/src/main/java/com/bbn/hadder/RethinkUser.java @@ -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()) { diff --git a/src/main/java/com/bbn/hadder/core/CommandHandler.java b/src/main/java/com/bbn/hadder/core/CommandHandler.java index 5f2029c..99fe82a 100644 --- a/src/main/java/com/bbn/hadder/core/CommandHandler.java +++ b/src/main/java/com/bbn/hadder/core/CommandHandler.java @@ -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; From 0db2933daff0965eb532867ad39d8fc05e8ce78f Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Tue, 28 Jan 2020 21:35:22 +0100 Subject: [PATCH 06/23] Some unimportant stuff yk --- .../bbn/hadder/listener/MentionListener.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/bbn/hadder/listener/MentionListener.java b/src/main/java/com/bbn/hadder/listener/MentionListener.java index d51cbe3..f7eae4e 100644 --- a/src/main/java/com/bbn/hadder/listener/MentionListener.java +++ b/src/main/java/com/bbn/hadder/listener/MentionListener.java @@ -19,7 +19,6 @@ package com.bbn.hadder.listener; import com.bbn.hadder.Rethink; import com.bbn.hadder.RethinkServer; import com.bbn.hadder.RethinkUser; -import com.bbn.hadder.utils.MessageEditor; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.ChannelType; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; @@ -56,31 +55,25 @@ public class MentionListener extends ListenerAdapter { } catch (IOException | XmlPullParserException ex) { ex.printStackTrace(); } - EmbedBuilder builder = new EmbedBuilder().setTitle("Hi!").addField("Version", model.getVersion(), false) - .addField("Userprefix", rethinkUser.getPrefix(), true).addField("Guildprefix", rethinkServer.getPrefix(), true); + EmbedBuilder builder = new EmbedBuilder() + .setTitle("Hi!") + .addField("Version", model.getVersion(), false) + .addField("User-Prefix", rethinkUser.getPrefix(), true) + .addField("Guild-Prefix", rethinkServer.getPrefix(), true); StringBuilder stringBuilder = new StringBuilder(); model.getDependencies().forEach( - dependency -> stringBuilder.append(dependency.getArtifactId()+" - "+dependency.getVersion()+"\n") + dependency -> stringBuilder.append(dependency.getArtifactId()).append(" - ").append(dependency.getVersion()).append("\n") ); builder.addField("Dependencies", stringBuilder.toString(), false); StringBuilder devs = new StringBuilder(); model.getDevelopers().forEach( - developer -> devs.append(developer.getId()+" - [Website]("+developer.getUrl()+"), [E-Mail](https://hax.bigbotnetwork.de/redirect.html?url=mailto:"+developer.getEmail()+")\n") + developer -> devs.append(developer.getId()).append(" - [Website](").append(developer.getUrl()).append("), [E-Mail](https://hax.bigbotnetwork.de/redirect.html?url=mailto:").append(developer.getEmail()).append(")\n") ); builder.addField("Developer", devs.toString(), false); builder.addField("Join our Dev Server!", "[Click here!](https://discord.gg/58My2dM)", true); builder.addField("Github", "[Click here!](https://github.com/BigBotNetwork/Hadder)",false); builder.addField("Twitch", "[Click here!](https://www.twitch.tv/bigbotnetwork)", false); e.getChannel().sendMessage(builder.build()).queue(); - - /*e.getChannel().sendMessage(new MessageEditor(rethinkUser, e.getAuthor()).getMessage(MessageEditor.MessageType.INFO) - .setTitle("Hello I'm Hadder.") - .setAuthor(e.getJDA().getSelfUser().getName(), e.getJDA().getSelfUser().getAvatarUrl(), e.getJDA().getSelfUser().getAvatarUrl()) - .addField("Users", String.valueOf(e.getJDA().getUsers().size()), false) - .addField("Guilds", String.valueOf(e.getJDA().getGuilds().size()), false) - .addField("Prefix (User)", rethinkUser.getPrefix(), false) - .addField("Prefix (Guild)", rethinkServer.getPrefix(), false) - .build()).queue();*/ } else if (e.getMessage().getContentRaw().equalsIgnoreCase("@someone")) { int member = new Random().nextInt(e.getGuild().getMembers().size() - 1); if (member > 0 && member < e.getGuild().getMembers().size()) { From 54441cb67238a68a00d5f7da28f1c8430cd0832b Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Tue, 28 Jan 2020 21:40:37 +0100 Subject: [PATCH 07/23] Unimportant pom stuff --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e0e3394..f9213e5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,10 +1,11 @@ - 4.0.0 + 4.0.0 Hadder Hadder + pom 1.0.0 Hadder @@ -13,6 +14,7 @@ UTF-8 1.13 1.13 + yyyy-MM-dd'T'HH:mm:ss'Z' From c192f4d3ce25d3dd79ba4e8d9fa07b0de2496006 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 07:13:58 +0000 Subject: [PATCH 08/23] Bump JDA from 4.1.1_103 to 4.1.1_104 Bumps JDA from 4.1.1_103 to 4.1.1_104. 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 f9213e5..5f71b3c 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ net.dv8tion JDA - 4.1.1_103 + 4.1.1_104 org.json From e67f0d7c966995f3756da223533dd22eae77b3dd Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 07:14:27 +0000 Subject: [PATCH 09/23] Bump maven-model from 3.5.4 to 3.6.3 Bumps [maven-model](https://github.com/apache/maven) from 3.5.4 to 3.6.3. - [Release notes](https://github.com/apache/maven/releases) - [Commits](https://github.com/apache/maven/compare/maven-3.5.4...maven-3.6.3) 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 f9213e5..ac341d4 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ org.apache.maven maven-model - 3.5.4 + 3.6.3 net.dv8tion From 438816feaa9b4e5cbcc043fae407ecbffa711ba3 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 07:14:40 +0000 Subject: [PATCH 10/23] Bump github-api from 1.105 to 1.106 Bumps github-api from 1.105 to 1.106. 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 f9213e5..3ebf5db 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ org.kohsuke github-api - 1.105 + 1.106 com.sedmelluq From 0558b63cfc17d7e8051dad804c51375ff6ab3c4a Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 08:17:28 +0100 Subject: [PATCH 11/23] Very important fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7a3ccf..67adf75 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Hax#6775 | h.help | Shows each command and explains its usage. | | h.about | Shows information about Hadder. | | h.equals | Checks if two strings are the same. | -| h.invite | Shows the invite link to invite Hadder to your server. | +| h.invite | Shows the invite link to invite Hadder to your server. | | h.ping | Shows the ping to the Discord API. | | h.avatar | Sends the avatar of the specified member. | | h.gif | Looks for a GIF on Giphy. | From 6fc9dd126b559080b74e305f169d37865a2c7fed Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 08:19:04 +0100 Subject: [PATCH 12/23] Use explicit scoping instead of the default package private level --- .../java/com/bbn/hadder/RethinkServer.java | 18 +++++++++--------- src/main/java/com/bbn/hadder/RethinkUser.java | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/bbn/hadder/RethinkServer.java b/src/main/java/com/bbn/hadder/RethinkServer.java index 04b11ca..ee88da6 100644 --- a/src/main/java/com/bbn/hadder/RethinkServer.java +++ b/src/main/java/com/bbn/hadder/RethinkServer.java @@ -24,15 +24,15 @@ public class RethinkServer { private Rethink rethink; - String accept_emote = null; - String decline_emote = null; - String id; - boolean invite_detect = false; - String message_id = null; - String neededstars = "3"; - String prefix = "h."; - String role_id = null; - String starboard = null; + public String accept_emote = null; + public String decline_emote = null; + public String id; + public boolean invite_detect = false; + public String message_id = null; + public String neededstars = "3"; + public String prefix = "h."; + public String role_id = null; + public String starboard = null; public RethinkServer(JSONObject object, Rethink rethink) { for (Field field : this.getClass().getDeclaredFields()) { diff --git a/src/main/java/com/bbn/hadder/RethinkUser.java b/src/main/java/com/bbn/hadder/RethinkUser.java index eba7564..6bce94a 100644 --- a/src/main/java/com/bbn/hadder/RethinkUser.java +++ b/src/main/java/com/bbn/hadder/RethinkUser.java @@ -24,10 +24,10 @@ public class RethinkUser { private Rethink rethink; - String id; - String prefix = "h."; - String language = "en"; - String blacklisted = null; + public String id; + public String prefix = "h."; + public String language = "en"; + public String blacklisted = null; public RethinkUser(JSONObject object, Rethink rethink) { for (Field field : this.getClass().getDeclaredFields()) { From 0b4cc1e792936275d07a7e58282375180014cacb Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 08:26:36 +0100 Subject: [PATCH 13/23] Blacklist i18n --- .../commands/owner/BlacklistCommand.java | 19 +++++++++---------- .../Translations/Translations_en.properties | 4 ++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java b/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java index 5bd8f3e..55e86b2 100644 --- a/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java +++ b/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java @@ -21,7 +21,6 @@ import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.core.Perm; import com.bbn.hadder.core.Perms; import com.bbn.hadder.utils.MessageEditor; -import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.User; import java.util.ArrayList; @@ -42,7 +41,7 @@ public class BlacklistCommand implements Command { if (args.length == 3) { String blacklisted = e.getRethinkUser().getBlacklisted(); List commands = new ArrayList<>(); - if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); + if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); commands.addAll(Arrays.asList(args[1].split(","))); LinkedHashSet hashSet = new LinkedHashSet<>(commands); @@ -50,9 +49,9 @@ public class BlacklistCommand implements Command { String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none"); e.getRethinkUser().setBlacklisted(newblacklisted); e.getTextChannel().sendMessage( - e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO) - .setTitle("Removed Blacklisted Commands from User") - .setDescription("Blacklisted commands: "+newblacklisted) + e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.owner.blacklist.success.add.title", "", + "commands.owner.blacklist.success.add.description", newblacklisted) .build()).queue(); e.getRethinkUser().push(); } @@ -62,7 +61,7 @@ public class BlacklistCommand implements Command { if (args.length == 3) { String blacklisted = e.getRethinkUser().getBlacklisted(); List commands = new ArrayList<>(); - if (!"none".equals(blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); + if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); commands.removeAll(Arrays.asList(args[1].split(","))); LinkedHashSet hashSet = new LinkedHashSet<>(commands); @@ -70,9 +69,9 @@ public class BlacklistCommand implements Command { String newblacklisted = ((commandsWithoutDuplicates.size()!=0) ? String.join(",", commandsWithoutDuplicates) : "none"); e.getRethinkUser().setBlacklisted(newblacklisted); e.getTextChannel().sendMessage( - e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO) - .setTitle("Removed Blacklisted Commands from User") - .setDescription("Blacklisted commands: "+newblacklisted) + e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.owner.blacklist.success.remove.title", "", + "commands.owner.blacklist.success.remove.description", newblacklisted) .build()).queue(); e.getRethinkUser().push(); } @@ -83,7 +82,7 @@ public class BlacklistCommand implements Command { for (User user : e.getJDA().getUsers()) { if (!user.getId().equals(e.getJDA().getSelfUser().getId())) { String blacklisted = e.getRethinkUser().getBlacklisted(); - if (!"none".equals(blacklisted)) { + if (!(null == blacklisted)) { stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n"); } } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index bef41a8..d43d1de 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -299,6 +299,10 @@ commands.owner.shutdown.success.title = Shutdown commands.owner.shutdown.help.description = Shuts the Bot down commands.owner.test.success = TEST my friends commands.owner.test.help.description = Just a little Test Command +commands.owner.blacklist.success.add.title = Successfully blacklisted the specified commands +commands.owner.blacklist.success.add.description = I successfully added the following commands from the blacklist:\n %extra% +commands.owner.blacklist.success.remove.title = Successfully removed the commands from the blacklist +commands.owner.blacklist.success.remove.description = I successfully removed the following commands from the blacklist:\n %extra% commands.owner.blacklist.help.description = Blacklist a user for specific commands commands.settings.language.success.title = Language set From cdff88174f021d2e61cf98333e695a56c3151725 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 08:30:59 +0100 Subject: [PATCH 14/23] Codacy stuff --- .../com/bbn/hadder/commands/owner/BlacklistCommand.java | 6 +++--- .../com/bbn/hadder/commands/settings/LanguageCommand.java | 1 - src/main/java/com/bbn/hadder/core/CommandHandler.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java b/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java index 55e86b2..70d596d 100644 --- a/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java +++ b/src/main/java/com/bbn/hadder/commands/owner/BlacklistCommand.java @@ -41,7 +41,7 @@ public class BlacklistCommand implements Command { if (args.length == 3) { String blacklisted = e.getRethinkUser().getBlacklisted(); List commands = new ArrayList<>(); - if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); + if (null != blacklisted) commands.addAll(Arrays.asList(blacklisted.split(","))); commands.addAll(Arrays.asList(args[1].split(","))); LinkedHashSet hashSet = new LinkedHashSet<>(commands); @@ -61,7 +61,7 @@ public class BlacklistCommand implements Command { if (args.length == 3) { String blacklisted = e.getRethinkUser().getBlacklisted(); List commands = new ArrayList<>(); - if (!(null == blacklisted)) commands.addAll(Arrays.asList(blacklisted.split(","))); + if (null != blacklisted) commands.addAll(Arrays.asList(blacklisted.split(","))); commands.removeAll(Arrays.asList(args[1].split(","))); LinkedHashSet hashSet = new LinkedHashSet<>(commands); @@ -82,7 +82,7 @@ public class BlacklistCommand implements Command { for (User user : e.getJDA().getUsers()) { if (!user.getId().equals(e.getJDA().getSelfUser().getId())) { String blacklisted = e.getRethinkUser().getBlacklisted(); - if (!(null == blacklisted)) { + if (null != blacklisted) { stringBuilder.append(user.getAsTag()).append(" (").append(user.getId()).append(") - ").append(blacklisted).append("\n"); } } diff --git a/src/main/java/com/bbn/hadder/commands/settings/LanguageCommand.java b/src/main/java/com/bbn/hadder/commands/settings/LanguageCommand.java index 9cece7a..67dd131 100644 --- a/src/main/java/com/bbn/hadder/commands/settings/LanguageCommand.java +++ b/src/main/java/com/bbn/hadder/commands/settings/LanguageCommand.java @@ -19,7 +19,6 @@ package com.bbn.hadder.commands.settings; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.utils.MessageEditor; -import net.dv8tion.jda.api.EmbedBuilder; public class LanguageCommand implements Command { diff --git a/src/main/java/com/bbn/hadder/core/CommandHandler.java b/src/main/java/com/bbn/hadder/core/CommandHandler.java index 99fe82a..78f2848 100644 --- a/src/main/java/com/bbn/hadder/core/CommandHandler.java +++ b/src/main/java/com/bbn/hadder/core/CommandHandler.java @@ -69,7 +69,7 @@ public class CommandHandler { boolean run = true; String blacklisted = rethinkUser.getBlacklisted(); - if (!(null == blacklisted)) { + if (null != blacklisted) { for (String BLLabel : blacklisted.split(",")) { if (Arrays.asList(cmd.labels()).contains(BLLabel)) { run = false; From 464664891738728b4612f7945ab598fd710e2e80 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 15:44:33 +0100 Subject: [PATCH 15/23] Some builder stuff --- src/main/java/com/bbn/hadder/Hadder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index ca360af..c27bb07 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -31,6 +31,7 @@ import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.entities.Activity; import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder; import net.dv8tion.jda.api.sharding.ShardManager; +import net.dv8tion.jda.api.utils.ChunkingFilter; import java.util.List; @@ -54,7 +55,9 @@ public class Hadder { builder.setAutoReconnect(true); builder.setShardsTotal(1); - builder.setActivity(Activity.streaming("on the BigBotNetwork", "https://twitch.tv/BigBotNetwork")); + builder.setChunkingFilter(ChunkingFilter.ALL); + builder.setBulkDeleteSplittingEnabled(true); + builder.setActivity(Activity.listening("to h.help")); builder.setStatus(OnlineStatus.DO_NOT_DISTURB); builder.setToken(config.getBotToken()); From 92150583320b0c1ef4b8fc91b111350b28a94b30 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 15:44:50 +0100 Subject: [PATCH 16/23] Update version for next release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0d1a8ed..7b817a0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ Hadder Hadder pom - 1.0.0 + 1.0.1 Hadder From 65ad656adbf24a59e5b5ab37a0579a0260a3621f Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 16:07:41 +0100 Subject: [PATCH 17/23] Introduce serverstats command --- src/main/java/com/bbn/hadder/Hadder.java | 3 +- .../commands/misc/ServerStatsCommand.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/ServerStatsCommand.java diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index c27bb07..08d0a21 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -123,7 +123,8 @@ public class Hadder { new PauseCommand(), new LoopCommand(), new BassCommand(), - new EchoCommand()), config, helpCommand); + new EchoCommand(), + new ServerStatsCommand()), config, helpCommand); builder.addEventListeners( new MentionListener(rethink), diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java new file mode 100644 index 0000000..278278c --- /dev/null +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.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 ServerStatsCommand implements Command { + + @Override + public void executed(String[] args, CommandEvent e) { + + } + + @Override + public String[] labels() { + return new String[]{"serverstats"}; + } + + @Override + public String description() { + return "commands.misc.serverstats.help.description"; + } + + @Override + public String usage() { + return "[Server-ID]"; + } + + @Override + public String example() { + return "448554629282922527"; + } +} diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index d43d1de..054727a 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -87,6 +87,7 @@ commands.misc.screenshare.number.error.description = This isn't a Number. commands.misc.screenshare.channel.existing.error = Hol' up commands.misc.screenshare.channel.existing.description = There is no Voice Channel named like this. \n\nNote\: Make sure the Voice Channel is in this Guild. commands.misc.screenshare.help.description = Shows you the link to share your screen. +commands.misc.serverstats.help.description = Shows information about a server. commands.moderation.ban.success.title = Successfully banned commands.moderation.ban.success.description = I successfully baned %extra% From c75c7dbcbb6c72a290a6a8e3bdbfe3391f0e4ae7 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 16:13:43 +0100 Subject: [PATCH 18/23] Help stuff --- .../java/com/bbn/hadder/commands/misc/ServerStatsCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java index 278278c..f8af606 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java @@ -23,7 +23,11 @@ public class ServerStatsCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { + if (args.length == 0) { + } else if (args.length == 1) { + + } else e.getHelpCommand().sendHelp(this, e); } @Override From 8367b1090f8c16f1fe5a2edb109d6d61fd84db1a Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Wed, 29 Jan 2020 16:34:30 +0100 Subject: [PATCH 19/23] TODO :eyes: --- src/main/java/com/bbn/hadder/listener/MentionListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/bbn/hadder/listener/MentionListener.java b/src/main/java/com/bbn/hadder/listener/MentionListener.java index f7eae4e..1e637b5 100644 --- a/src/main/java/com/bbn/hadder/listener/MentionListener.java +++ b/src/main/java/com/bbn/hadder/listener/MentionListener.java @@ -66,6 +66,7 @@ public class MentionListener extends ListenerAdapter { ); builder.addField("Dependencies", stringBuilder.toString(), false); StringBuilder devs = new StringBuilder(); + //TODO: Fix Mail stuff model.getDevelopers().forEach( developer -> devs.append(developer.getId()).append(" - [Website](").append(developer.getUrl()).append("), [E-Mail](https://hax.bigbotnetwork.de/redirect.html?url=mailto:").append(developer.getEmail()).append(")\n") ); From 887a494509edaed54161cdf002e0dca5cc7b4560 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Thu, 30 Jan 2020 08:07:57 +0100 Subject: [PATCH 20/23] Real stats about a server --- .../hadder/commands/misc/ServerStatsCommand.java | 16 +++++++++------- .../Translations/Translations_en.properties | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java index f8af606..bad5c30 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java @@ -18,16 +18,18 @@ package com.bbn.hadder.commands.misc; import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.CommandEvent; +import com.bbn.hadder.utils.MessageEditor; public class ServerStatsCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { - if (args.length == 0) { - - } else if (args.length == 1) { - - } else e.getHelpCommand().sendHelp(this, e); + e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.misc.serverstats.title", "", + "commands.misc.serverstats.description", e.getGuild().getName()) + .addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), false) + .addField("ID", e.getGuild().getId(), false) + .build()).queue(); } @Override @@ -42,11 +44,11 @@ public class ServerStatsCommand implements Command { @Override public String usage() { - return "[Server-ID]"; + return null; } @Override public String example() { - return "448554629282922527"; + return null; } } diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 054727a..aa667ef 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -87,6 +87,8 @@ commands.misc.screenshare.number.error.description = This isn't a Number. commands.misc.screenshare.channel.existing.error = Hol' up commands.misc.screenshare.channel.existing.description = There is no Voice Channel named like this. \n\nNote\: Make sure the Voice Channel is in this Guild. commands.misc.screenshare.help.description = Shows you the link to share your screen. +commands.misc.serverstats.title = Serverstats +commands.misc.serverstats.description = This message contains some information about `%extra%` commands.misc.serverstats.help.description = Shows information about a server. commands.moderation.ban.success.title = Successfully banned From c7fd92fbaf36e274664e74003ce6aa1b60ef147a Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Thu, 30 Jan 2020 08:39:12 +0100 Subject: [PATCH 21/23] There is a bug --- .../java/com/bbn/hadder/commands/misc/ServerStatsCommand.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java index bad5c30..c0896b9 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java @@ -29,6 +29,9 @@ public class ServerStatsCommand implements Command { "commands.misc.serverstats.description", e.getGuild().getName()) .addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), false) .addField("ID", e.getGuild().getId(), false) + .addField("Region", e.getGuild().getRegion().getName(), false) + .setThumbnail(e.getGuild().getIconUrl()) + .setImage(e.getGuild().getBannerUrl()) .build()).queue(); } From e16f97acc0706b8bf1b30da0190d51e3d1c9fcbc Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 1 Feb 2020 13:09:19 +0100 Subject: [PATCH 22/23] #359 --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7b817a0..4535f77 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,6 @@ 4.0.0 Hadder Hadder - pom 1.0.1 Hadder From a5c432157f1db885eb541c3adcc32f8b10df3226 Mon Sep 17 00:00:00 2001 From: GregTCLTK Date: Sat, 1 Feb 2020 13:32:17 +0100 Subject: [PATCH 23/23] Serverstats --- .../commands/misc/ServerStatsCommand.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java index c0896b9..9c12a6c 100644 --- a/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java +++ b/src/main/java/com/bbn/hadder/commands/misc/ServerStatsCommand.java @@ -19,20 +19,28 @@ 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 net.dv8tion.jda.api.EmbedBuilder; + +import java.util.Date; public class ServerStatsCommand implements Command { @Override public void executed(String[] args, CommandEvent e) { - e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + EmbedBuilder eb = e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "commands.misc.serverstats.title", "", "commands.misc.serverstats.description", e.getGuild().getName()) - .addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), false) - .addField("ID", e.getGuild().getId(), false) - .addField("Region", e.getGuild().getRegion().getName(), false) + .addField("Owner", e.getGuild().getOwner().getUser().getAsTag(), true) + .addField("ID", e.getGuild().getId(), true) + .addField("Region", e.getGuild().getRegion().getName(), true) + .addField("Time created", new Date(e.getGuild().getTimeCreated().toInstant().toEpochMilli()).toString(), true) .setThumbnail(e.getGuild().getIconUrl()) - .setImage(e.getGuild().getBannerUrl()) - .build()).queue(); + .setImage(e.getGuild().getBannerUrl()); + + if (e.getGuild().getDescription() != null) eb.addField("Description", e.getGuild().getDescription(), true); + if (e.getGuild().getVanityCode() != null) eb.addField("Vanity Code", "[" + e.getGuild().getVanityCode() + "](https://discord.gg/" + e.getGuild().getVanityCode() + ")", true); + + e.getTextChannel().sendMessage(eb.build()).queue(); } @Override