Skip to content

Commit

Permalink
Created a simple .info command.
Browse files Browse the repository at this point in the history
  • Loading branch information
DV8FromTheWorld committed Mar 21, 2016
1 parent 69fe541 commit 0510dea
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/main/java/net/dv8tion/discord/Yui.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import net.dv8tion.discord.bridge.IrcConnectInfo;
Expand All @@ -23,7 +18,6 @@
import net.dv8tion.jda.JDABuilder;
import net.dv8tion.jda.entities.Guild;
import net.dv8tion.jda.entities.TextChannel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;

import javax.security.auth.login.LoginException;
Expand Down Expand Up @@ -111,6 +105,7 @@ private static void setupBot()
jdaBuilder.addListener(help.registerCommand(new PermissionsCommand()));
jdaBuilder.addListener(help.registerCommand(new EvalCommand()));
jdaBuilder.addListener(help.registerCommand(new RollCommand()));
jdaBuilder.addListener(help.registerCommand(new InfoCommand()));

for (IrcConnectInfo info : settings.getIrcConnectInfos())
{
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/net/dv8tion/discord/commands/InfoCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package net.dv8tion.discord.commands;

import net.dv8tion.jda.JDAInfo;
import net.dv8tion.jda.MessageBuilder;
import net.dv8tion.jda.events.message.MessageReceivedEvent;

import java.util.Arrays;
import java.util.List;

/**
* Created by Austin on 3/21/2016.
*/
public class InfoCommand extends Command

{
@Override
public void onCommand(MessageReceivedEvent e, String[] args)
{
MessageBuilder builder = new MessageBuilder();
builder.appendString("__Yui Information__\n")
.appendString("__Creator__\n")
.appendString(" **Name**: DV8FromTheWorld (#6297)\n")
.appendString(" **ID**: 107562988810027008\n")
.appendString(" **Github**: <http://code.dv8tion.net>\n")
.appendString("__Development__\n")
.appendString(" **Language**: Java 8\n")
.appendString(" **Library**: JDA - v" + JDAInfo.VERSION + "\n")
.appendString(" **Source**: <https://github.com/DV8FromTheWorld/Yui>");
sendMessage(e, builder.build());
}

@Override
public List<String> getAliases()
{
return Arrays.asList(".info");
}

@Override
public String getDescription()
{
return "Provides information about Yui.";
}

@Override
public String getName()
{
return "Yui Information";
}

@Override
public List<String> getUsageInstructions()
{
return Arrays.asList(".info - Prints all information pertaining to the current instance of Yui.");
}
}

0 comments on commit 0510dea

Please sign in to comment.