diff --git a/pom.xml b/pom.xml index b900e3b..700563d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,22 +35,22 @@ com.rethinkdb rethinkdb-driver - LATEST + 2.3.3 com.google.code.gson gson - LATEST + 2.8.6 org.slf4j slf4j-api - 1.7.5 + 1.7.29 org.slf4j slf4j-simple - 1.6.4 + 1.7.29 @@ -71,7 +71,7 @@ maven-resources-plugin - 3.0.2 + 3.1.0 maven-compiler-plugin diff --git a/src/main/java/com/bbn/hadder/Hadder.java b/src/main/java/com/bbn/hadder/Hadder.java index 3b44930..76a3397 100644 --- a/src/main/java/com/bbn/hadder/Hadder.java +++ b/src/main/java/com/bbn/hadder/Hadder.java @@ -4,6 +4,7 @@ import com.bbn.hadder.commands.general.*; import com.bbn.hadder.commands.fun.GifCommand; import com.bbn.hadder.commands.misc.GitHubCommand; 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.settings.PrefixCommand; @@ -24,7 +25,10 @@ import java.util.List; public class Hadder { public static void main(String[] args) { + startBot(); + } + public static void startBot() { File configfile = new File("./config.json"); if (!configfile.exists()) { System.err.println("No Config File Found!"); @@ -47,8 +51,8 @@ public class Hadder { builder.setToken(config.getString("Token")); - CommandHandler.cmdlist.addAll(List.of(new HelpCommand(), new TestCommand(), new BanCommand(), new PrefixCommand(), new ShutdownCommand(), new KickCommand(), new PingCommand(), new GifCommand(), new ClearCommand(), new GitHubCommand())); - + CommandHandler.cmdlist.addAll(List.of(new HelpCommand(), new TestCommand(), new BanCommand(), new PrefixCommand(), new ShutdownCommand(), new KickCommand(), new PingCommand(), new GifCommand(), new ClearCommand(), new GitHubCommand(), new RebootCommand())); + builder.addEventListeners( new MentionListener(), new PrivateMessageListener(), @@ -61,7 +65,5 @@ public class Hadder { } catch (LoginException e) { e.printStackTrace(); } - } - } diff --git a/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java b/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java new file mode 100644 index 0000000..2e4c609 --- /dev/null +++ b/src/main/java/com/bbn/hadder/commands/owner/RebootCommand.java @@ -0,0 +1,44 @@ +package com.bbn.hadder.commands.owner; + +/* + * @author Skidder / GregTCLTK + */ + +import com.bbn.hadder.Rethink; +import com.bbn.hadder.commands.Command; +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 { + + @Override + public void executed(String[] args, MessageReceivedEvent event) { + if (event.getAuthor().getId().equals("477141528981012511") || event.getAuthor().getId().equals("261083609148948488")) { + + } else { + EmbedBuilder builder = new EmbedBuilder(); + event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.NO_PERMISSION, builder).build()).queue(); + } + } + + @Override + public String[] labels() { + return new String[]{"restart"}; + } + + @Override + public String description() { + return "Restart the bot"; + } + + @Override + public String usage() { + return labels()[0]; + } +}