Merge remote-tracking branch 'origin/master' into hax-dev
This commit is contained in:
commit
5d4f33a7bd
18 changed files with 27 additions and 58 deletions
6
pom.xml
6
pom.xml
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<groupId>Hadder</groupId>
|
<groupId>Hadder</groupId>
|
||||||
<artifactId>Hadder</artifactId>
|
<artifactId>Hadder</artifactId>
|
||||||
<version>0.3-ALPHA</version>
|
<version>0.7-ALPHA</version>
|
||||||
|
|
||||||
<name>Hadder</name>
|
<name>Hadder</name>
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>LATEST</version>
|
<version>4.0.0_56</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<finalName>Hadder-Build</finalName>
|
<finalName>Hadder-Build</finalName>
|
||||||
<archive>
|
<archive>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,12 @@
|
||||||
package com.bbn.hadder;
|
package com.bbn.hadder;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.general.*;
|
import com.bbn.hadder.commands.general.*;
|
||||||
import com.bbn.hadder.commands.fun.GifCommand;
|
import com.bbn.hadder.commands.misc.*;
|
||||||
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.moderation.*;
|
import com.bbn.hadder.commands.moderation.*;
|
||||||
import com.bbn.hadder.commands.owner.RebootCommand;
|
import com.bbn.hadder.commands.owner.*;
|
||||||
import com.bbn.hadder.commands.owner.ShutdownCommand;
|
import com.bbn.hadder.commands.fun.GifCommand;
|
||||||
import com.bbn.hadder.commands.owner.TestCommand;
|
|
||||||
import com.bbn.hadder.commands.settings.PrefixCommand;
|
import com.bbn.hadder.commands.settings.PrefixCommand;
|
||||||
import com.bbn.hadder.core.CommandHandler;
|
import com.bbn.hadder.core.*;
|
||||||
import com.bbn.hadder.core.Config;
|
|
||||||
import com.bbn.hadder.listener.*;
|
import com.bbn.hadder.listener.*;
|
||||||
import net.dv8tion.jda.api.entities.Activity;
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
|
import net.dv8tion.jda.api.sharding.DefaultShardManagerBuilder;
|
||||||
|
|
@ -52,7 +47,7 @@ public class Hadder {
|
||||||
new ShutdownCommand(),
|
new ShutdownCommand(),
|
||||||
new KickCommand(),
|
new KickCommand(),
|
||||||
new PingCommand(),
|
new PingCommand(),
|
||||||
new GifCommand(),
|
new GifCommand(config),
|
||||||
new ClearCommand(),
|
new ClearCommand(),
|
||||||
new GitHubCommand(),
|
new GitHubCommand(),
|
||||||
new ScreenshareCommand(),
|
new ScreenshareCommand(),
|
||||||
|
|
|
||||||
|
|
@ -6,23 +6,25 @@ package com.bbn.hadder.commands.fun;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
|
import com.bbn.hadder.core.Config;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
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;
|
import java.util.Random;
|
||||||
|
|
||||||
public class GifCommand implements Command {
|
public class GifCommand implements Command {
|
||||||
|
|
||||||
|
private Config config;
|
||||||
|
|
||||||
|
public GifCommand(Config config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent event) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|
@ -32,16 +34,8 @@ public class GifCommand implements Command {
|
||||||
query = new StringBuilder(query.substring(0, query.length() - 1));
|
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();
|
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 {
|
try {
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
Response response = caller.newCall(request).execute();
|
Response response = caller.newCall(request).execute();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.bbn.hadder.commands.general;
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.core.CommandHandler;
|
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
public class PingCommand implements Command {
|
public class PingCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.EventWaiter;
|
import com.bbn.hadder.utils.EventWaiter;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
public class EqualsCommand implements Command {
|
public class EqualsCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import com.bbn.hadder.utils.EventWaiter;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -25,8 +24,8 @@ public class ScreenshareCommand implements Command {
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.ERROR, new EmbedBuilder()
|
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.ERROR, new EmbedBuilder()
|
||||||
.setTitle("Wait, thats illegal")
|
.setTitle("Wait, that's illegal")
|
||||||
.setDescription("This Id is invalid. \nMaybe you entered a wrong Id? \n\nNote: Make sure the Voicechannel is on this Guild.")).build()).queue();
|
.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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
public class BanCommand implements Command {
|
public class BanCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,10 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.Message;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static java.time.temporal.ChronoUnit.DAYS;
|
|
||||||
|
|
||||||
public class ClearCommand implements Command {
|
public class ClearCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
public class KickCommand implements Command {
|
public class KickCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,11 @@ package com.bbn.hadder.commands.owner;
|
||||||
* @author Skidder / GregTCLTK
|
* @author Skidder / GregTCLTK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
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 {
|
public class RebootCommand implements Command {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
public class ShutdownCommand implements Command {
|
public class ShutdownCommand implements Command {
|
||||||
@Override
|
@Override
|
||||||
public void executed(String[] args, CommandEvent event) {
|
public void executed(String[] args, CommandEvent event) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,7 @@
|
||||||
package com.bbn.hadder.commands.owner;
|
package com.bbn.hadder.commands.owner;
|
||||||
|
|
||||||
/*
|
|
||||||
* @author Skidder / GregTCLTK
|
|
||||||
*/
|
|
||||||
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author Skidder / GregTCLTK
|
* @author Skidder / GregTCLTK
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,10 @@ package com.bbn.hadder.commands.settings;
|
||||||
* @author Skidder / GregTCLTK
|
* @author Skidder / GregTCLTK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.bbn.hadder.Rethink;
|
|
||||||
import com.bbn.hadder.commands.Command;
|
import com.bbn.hadder.commands.Command;
|
||||||
import com.bbn.hadder.commands.CommandEvent;
|
import com.bbn.hadder.commands.CommandEvent;
|
||||||
import com.bbn.hadder.utils.MessageEditor;
|
import com.bbn.hadder.utils.MessageEditor;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
|
||||||
|
|
||||||
|
|
||||||
public class PrefixCommand implements Command {
|
public class PrefixCommand implements Command {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ public class GuildListener extends ListenerAdapter {
|
||||||
rethink.insertServer(event.getGuild().getId());
|
rethink.insertServer(event.getGuild().getId());
|
||||||
EmbedBuilder builder = new EmbedBuilder();
|
EmbedBuilder builder = new EmbedBuilder();
|
||||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
|
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("Name", event.getGuild().getName(), true)
|
||||||
.addField("Guild ID", event.getGuild().getId(), true)
|
.addField("Guild ID", event.getGuild().getId(), true)
|
||||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
||||||
|
|
@ -51,7 +52,8 @@ public class GuildListener extends ListenerAdapter {
|
||||||
public void onGuildLeave(GuildLeaveEvent event) {
|
public void onGuildLeave(GuildLeaveEvent event) {
|
||||||
EmbedBuilder builder = new EmbedBuilder();
|
EmbedBuilder builder = new EmbedBuilder();
|
||||||
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
|
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("Name", event.getGuild().getName(), true)
|
||||||
.addField("Guild ID", event.getGuild().getId(), true)
|
.addField("Guild ID", event.getGuild().getId(), true)
|
||||||
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
.addField("Guild Owner", event.getGuild().getOwner().getUser().getAsTag(), true)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,11 @@ public class PrivateMessageListener extends ListenerAdapter {
|
||||||
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
PrivateChannel Skidder = event.getJDA().getUserById("477141528981012511").openPrivateChannel().complete();
|
||||||
PrivateChannel Hax = event.getJDA().getUserById("261083609148948488").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();
|
Skidder.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
|
||||||
Hax.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
|
Hax.sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, message).build()).queue();
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import okhttp3.Request;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue