Merge remote-tracking branch 'origin/master' into hax-dev

This commit is contained in:
Hax 2019-11-06 20:13:45 +01:00
commit 5d4f33a7bd
18 changed files with 27 additions and 58 deletions

View file

@ -5,7 +5,7 @@
<groupId>Hadder</groupId>
<artifactId>Hadder</artifactId>
<version>0.3-ALPHA</version>
<version>0.7-ALPHA</version>
<name>Hadder</name>
@ -25,7 +25,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>LATEST</version>
<version>4.0.0_56</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
@ -83,7 +83,7 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<configuration>
<finalName>Hadder-Build</finalName>
<archive>

View file

@ -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(),

View file

@ -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();

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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) {

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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();

View file

@ -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;