diff --git a/src/main/java/net/romvoid/crashbot/commands/GitCommand.java b/src/main/java/net/romvoid/crashbot/commands/GitCommand.java new file mode 100644 index 0000000..6d2d80b --- /dev/null +++ b/src/main/java/net/romvoid/crashbot/commands/GitCommand.java @@ -0,0 +1,36 @@ +package net.romvoid.crashbot.commands; + +import java.util.concurrent.TimeUnit; + +import com.jagrosh.jdautilities.command.Command; +import com.jagrosh.jdautilities.command.CommandEvent; + +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.Permission; +import net.dv8tion.jda.api.entities.Message; +import net.dv8tion.jda.api.entities.MessageChannel; +import net.romvoid.crashbot.Bot; +import net.romvoid.crashbot.utilities.EmbedUtil; + +public class GitCommand extends Command { + + public GitCommand() { + this.name = "git"; + this.help = "Returns the GitBucket repository for the bot"; + this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; + this.guildOnly = false; + } + + @Override + protected void execute(CommandEvent event) { + Bot.LOG.info(event.getAuthor().getName() + " invoked command " + this.name); + + MessageChannel channel = event.getChannel(); + EmbedBuilder embed = EmbedUtil.embed("CrashBot GitBucket", + "Have an issue? Or want to contribute? Head on over to my GitBucket Repo!"); + embed.addField("GitBucket Link", "[GitgBucket Repository](http://gitbucket.mfnd.ru/y.varenkov/CrashLogBot)", false); + Message msg = EmbedUtil.message(embed); + EmbedUtil.sendAndDeleteOnGuilds(channel, msg, 2, TimeUnit.MINUTES); + event.getMessage().delete().queue(); + } +}