diff --git a/pom.xml b/pom.xml
index 0c52d08..23bcffe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
Hadder
Hadder
- 0.3-ALPHA
+ 0.7-ALPHA
Hadder
diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java
index b127d73..5cf0dfc 100644
--- a/src/main/java/com/bbn/hadder/Hadder.java
+++ b/src/main/java/com/bbn/hadder/Hadder.java
@@ -1,17 +1,12 @@
package com.bbn.hadder;
import com.bbn.hadder.commands.general.*;
-import com.bbn.hadder.commands.fun.GifCommand;
-import com.bbn.hadder.commands.misc.EqualsCommand;
-import com.bbn.hadder.commands.misc.GitHubCommand;
-import com.bbn.hadder.commands.misc.ScreenshareCommand;
+import com.bbn.hadder.commands.misc.*;
import com.bbn.hadder.commands.moderation.*;
-import com.bbn.hadder.commands.owner.RebootCommand;
-import com.bbn.hadder.commands.owner.ShutdownCommand;
-import com.bbn.hadder.commands.owner.TestCommand;
+import com.bbn.hadder.commands.owner.*;
+import com.bbn.hadder.commands.fun.GifCommand;
import com.bbn.hadder.commands.settings.PrefixCommand;
-import com.bbn.hadder.core.CommandHandler;
-import com.bbn.hadder.core.Config;
+import com.bbn.hadder.core.*;
import com.bbn.hadder.listener.*;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
@@ -52,7 +47,7 @@ public class Hadder {
new ShutdownCommand(),
new KickCommand(),
new PingCommand(),
- new GifCommand(),
+ new GifCommand(config),
new ClearCommand(),
new GitHubCommand(),
new ScreenshareCommand(),
diff --git a/src/main/java/com/bbn/hadder/commands/fun/GifCommand.java b/src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
index 4c25775..14c068e 100644
--- a/src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/fun/GifCommand.java
@@ -6,23 +6,25 @@ package com.bbn.hadder.commands.fun;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
+import com.bbn.hadder.core.Config;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONArray;
import org.json.JSONObject;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import java.util.Random;
public class GifCommand implements Command {
+ private Config config;
+
+ public GifCommand(Config config) {
+ this.config = config;
+ }
+
@Override
public void executed(String[] args, CommandEvent event) {
if (args.length > 0) {
@@ -32,16 +34,8 @@ public class GifCommand implements Command {
query = new StringBuilder(query.substring(0, query.length() - 1));
}
- File configfile = new File("./config.json");
-
- JSONObject config = null;
- try {
- config = new JSONObject(new String(Files.readAllBytes(Paths.get(configfile.toURI()))));
- } catch (IOException e) {
- e.printStackTrace();
- }
OkHttpClient caller = new OkHttpClient();
- Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + config.getString("Giphy")).build();
+ Request request = new Request.Builder().url("http://api.giphy.com/v1/gifs/search?q=" + query + "&api_key=" + config.getGiphyToken()).build();
try {
Random rand = new Random();
Response response = caller.newCall(request).execute();
diff --git a/src/main/java/com/bbn/hadder/commands/general/HelpCommand.java b/src/main/java/com/bbn/hadder/commands/general/HelpCommand.java
index fba0059..bcc800d 100644
--- a/src/main/java/com/bbn/hadder/commands/general/HelpCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/general/HelpCommand.java
@@ -2,7 +2,6 @@ package com.bbn.hadder.commands.general;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
-import com.bbn.hadder.core.CommandHandler;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
diff --git a/src/main/java/com/bbn/hadder/commands/general/PingCommand.java b/src/main/java/com/bbn/hadder/commands/general/PingCommand.java
index 7322142..5db17c0 100644
--- a/src/main/java/com/bbn/hadder/commands/general/PingCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/general/PingCommand.java
@@ -8,7 +8,6 @@ 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 net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PingCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/commands/misc/EqualsCommand.java b/src/main/java/com/bbn/hadder/commands/misc/EqualsCommand.java
index 5485a9d..ec1a33c 100644
--- a/src/main/java/com/bbn/hadder/commands/misc/EqualsCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/misc/EqualsCommand.java
@@ -5,7 +5,6 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.EventWaiter;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class EqualsCommand implements Command {
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 3ba1732..a75f0d4 100644
--- a/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/misc/GitHubCommand.java
@@ -8,7 +8,6 @@ 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 net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
diff --git a/src/main/java/com/bbn/hadder/commands/misc/ScreenshareCommand.java b/src/main/java/com/bbn/hadder/commands/misc/ScreenshareCommand.java
index b613766..7c5f810 100644
--- a/src/main/java/com/bbn/hadder/commands/misc/ScreenshareCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/misc/ScreenshareCommand.java
@@ -6,7 +6,6 @@ import com.bbn.hadder.utils.EventWaiter;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.VoiceChannel;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.List;
@@ -25,8 +24,8 @@ public class ScreenshareCommand implements Command {
}
} catch (NumberFormatException e) {
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.ERROR, new EmbedBuilder()
- .setTitle("Wait, thats illegal")
- .setDescription("This Id is invalid. \nMaybe you entered a wrong Id? \n\nNote: Make sure the Voicechannel is on this Guild.")).build()).queue();
+ .setTitle("Wait, that's illegal")
+ .setDescription("This ID is invalid. \nMaybe you entered a wrong ID? \n\nNote: Make sure the Voice Channel is on this Guild.")).build()).queue();
return;
}
}
diff --git a/src/main/java/com/bbn/hadder/commands/moderation/BanCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/BanCommand.java
index 17e0d49..5d61ed8 100644
--- a/src/main/java/com/bbn/hadder/commands/moderation/BanCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/moderation/BanCommand.java
@@ -10,7 +10,6 @@ import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class BanCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/commands/moderation/ClearCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/ClearCommand.java
index 04a6d59..b327476 100644
--- a/src/main/java/com/bbn/hadder/commands/moderation/ClearCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/moderation/ClearCommand.java
@@ -10,13 +10,10 @@ import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Message;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
-import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
-import static java.time.temporal.ChronoUnit.DAYS;
public class ClearCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/commands/moderation/KickCommand.java b/src/main/java/com/bbn/hadder/commands/moderation/KickCommand.java
index 10cbb3c..74ca429 100644
--- a/src/main/java/com/bbn/hadder/commands/moderation/KickCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/moderation/KickCommand.java
@@ -10,7 +10,6 @@ import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Member;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class KickCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java b/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java
index 3db61ae..0923ba1 100644
--- a/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java
@@ -4,17 +4,11 @@ package com.bbn.hadder.commands.owner;
* @author Skidder / GregTCLTK
*/
-import com.bbn.hadder.Rethink;
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 net.dv8tion.jda.api.events.message.MessageReceivedEvent;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import static com.bbn.hadder.Hadder.startBot;
public class RebootCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/commands/owner/ShutdownCommand.java b/src/main/java/com/bbn/hadder/commands/owner/ShutdownCommand.java
index 4c94bd5..2583570 100644
--- a/src/main/java/com/bbn/hadder/commands/owner/ShutdownCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/owner/ShutdownCommand.java
@@ -9,8 +9,6 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
-
public class ShutdownCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
diff --git a/src/main/java/com/bbn/hadder/commands/owner/TestCommand.java b/src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
index 31207b3..6c21042 100644
--- a/src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/owner/TestCommand.java
@@ -1,12 +1,7 @@
package com.bbn.hadder.commands.owner;
-/*
- * @author Skidder / GregTCLTK
- */
-
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
/*
* @author Skidder / GregTCLTK
diff --git a/src/main/java/com/bbn/hadder/commands/settings/PrefixCommand.java b/src/main/java/com/bbn/hadder/commands/settings/PrefixCommand.java
index 5d8397e..e2e79dc 100644
--- a/src/main/java/com/bbn/hadder/commands/settings/PrefixCommand.java
+++ b/src/main/java/com/bbn/hadder/commands/settings/PrefixCommand.java
@@ -4,12 +4,10 @@ package com.bbn.hadder.commands.settings;
* @author Skidder / GregTCLTK
*/
-import com.bbn.hadder.Rethink;
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 net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PrefixCommand implements Command {
diff --git a/src/main/java/com/bbn/hadder/listener/GuildListener.java b/src/main/java/com/bbn/hadder/listener/GuildListener.java
index b3a9f39..789e8b7 100644
--- a/src/main/java/com/bbn/hadder/listener/GuildListener.java
+++ b/src/main/java/com/bbn/hadder/listener/GuildListener.java
@@ -37,7 +37,8 @@ public class GuildListener extends ListenerAdapter {
rethink.insertServer(event.getGuild().getId());
EmbedBuilder builder = new EmbedBuilder();
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
- .setTitle("Joined Server").setThumbnail(event.getGuild().getIconUrl())
+ .setTitle("Joined Server")
+ .setThumbnail(event.getGuild().getIconUrl())
.addField("Name", event.getGuild().getName(), true)
.addField("Guild ID", event.getGuild().getId(), true)
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
@@ -51,7 +52,8 @@ public class GuildListener extends ListenerAdapter {
public void onGuildLeave(GuildLeaveEvent event) {
EmbedBuilder builder = new EmbedBuilder();
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
- .setTitle("Left Server").setThumbnail(event.getGuild().getIconUrl())
+ .setTitle("Left Server")
+ .setThumbnail(event.getGuild().getIconUrl())
.addField("Name", event.getGuild().getName(), true)
.addField("Guild ID", event.getGuild().getId(), true)
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
diff --git a/src/main/java/com/bbn/hadder/listener/PrivateMessageListener.java b/src/main/java/com/bbn/hadder/listener/PrivateMessageListener.java
index 2486190..bb00fa4 100644
--- a/src/main/java/com/bbn/hadder/listener/PrivateMessageListener.java
+++ b/src/main/java/com/bbn/hadder/listener/PrivateMessageListener.java
@@ -22,7 +22,11 @@ public class PrivateMessageListener extends ListenerAdapter {
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
PrivateChannel Hax = event.getJDA().getUserById("261083609148948488").openPrivateChannel().complete();
- EmbedBuilder message = new EmbedBuilder().setTitle("New DM by " + event.getAuthor().getAsTag()).setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl()).setDescription(event.getMessage().getContentRaw()).setTimestamp(Instant.now());
+ EmbedBuilder message = new EmbedBuilder()
+ .setTitle("New DM by " + event.getAuthor().getAsTag())
+ .setAuthor(event.getAuthor().getName(), event.getAuthor().getAvatarUrl(), event.getAuthor().getAvatarUrl())
+ .setDescription(event.getMessage().getContentRaw())
+ .setTimestamp(Instant.now());
Skidder.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
Hax.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
diff --git a/src/main/java/com/bbn/hadder/utils/BotList.java b/src/main/java/com/bbn/hadder/utils/BotList.java
index e0e9853..aeddf4a 100644
--- a/src/main/java/com/bbn/hadder/utils/BotList.java
+++ b/src/main/java/com/bbn/hadder/utils/BotList.java
@@ -12,7 +12,6 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import org.json.JSONObject;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;