From 041bb9c5bea1f9131c424c34c2af75cc0175198b Mon Sep 17 00:00:00 2001 From: RedstoneTek Date: Fri, 28 Jun 2019 19:54:30 -0400 Subject: [PATCH] Added the credits command. --- pom.xml | 2 +- .../tek/guardian/commands/CreditsCommand.java | 39 +++++++++++++++++++ .../java/com/tek/guardian/main/Guardian.java | 2 + 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/tek/guardian/commands/CreditsCommand.java diff --git a/pom.xml b/pom.xml index 89e4c5d..b8a1c62 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.tek guardian - 1.2 + 1.3 jar guardian diff --git a/src/main/java/com/tek/guardian/commands/CreditsCommand.java b/src/main/java/com/tek/guardian/commands/CreditsCommand.java new file mode 100644 index 0000000..28745cd --- /dev/null +++ b/src/main/java/com/tek/guardian/commands/CreditsCommand.java @@ -0,0 +1,39 @@ +package com.tek.guardian.commands; + +import java.awt.Color; +import java.util.Arrays; + +import com.tek.guardian.data.ServerProfile; +import com.tek.guardian.main.Reference; + +import net.dv8tion.jda.api.JDA; +import net.dv8tion.jda.api.entities.Guild; +import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.MessageEmbed; +import net.dv8tion.jda.api.entities.TextChannel; + +public class CreditsCommand extends Command { + + public CreditsCommand() { + super("credits", Arrays.asList("info", "desc", "description"), null, "Displays the bot credits and information.", true); + } + + @Override + public boolean call(JDA jda, ServerProfile profile, Member member, Guild guild, TextChannel channel, String label, String[] args) { + if(args.length == 0) { + MessageEmbed embed = Reference.formatEmbed(jda, "Credits") + .setColor(Color.green) + .setDescription("Some credits and information about the bot.") + .addField("Huge thanks to", "[Austin Keener](https://github.com/DV8FromTheWorld) - Developer of JDA\n[John Grosh](https://github.com/jagrosh) - Developer of JDA Utilities\nDiscord - Hosting this cool event /o/\nFriends - Epic ideas and support", true) + .addField("Discord Library", "[JDA](https://github.com/DV8FromTheWorld/JDA) - Java", true) + .addField("Developer", "RedstoneTek / Toon Link#8313", true) + .addField("Additional Information", "This bot was made in 5 days within the **Discord Hack Week**.", true) + .build(); + channel.sendMessage(embed).queue(); + return true; + } else { + return false; + } + } + +} diff --git a/src/main/java/com/tek/guardian/main/Guardian.java b/src/main/java/com/tek/guardian/main/Guardian.java index 57bb6bc..f5fc4bc 100644 --- a/src/main/java/com/tek/guardian/main/Guardian.java +++ b/src/main/java/com/tek/guardian/main/Guardian.java @@ -13,6 +13,7 @@ import com.tek.guardian.commands.ClearCommand; import com.tek.guardian.commands.CommandHandler; import com.tek.guardian.commands.ConfigCommand; +import com.tek.guardian.commands.CreditsCommand; import com.tek.guardian.commands.CustomVoiceChannelCommand; import com.tek.guardian.commands.DeafenCommand; import com.tek.guardian.commands.GuideCommand; @@ -116,6 +117,7 @@ public void start() throws LoginException, InterruptedException { commandHandler.registerCommand(new TempdeafenCommand()); commandHandler.registerCommand(new UndeafenCommand()); commandHandler.registerCommand(new PingCommand()); + commandHandler.registerCommand(new CreditsCommand()); jda.addEventListener(waiter, commandHandler, new ServerStatusListener(), new VoiceChannelListener(), new AccountFlaggingListener(), new ReactionRoleListener(),