Added help function. Work in progress.

This commit is contained in:
Andrew Lalis 2017-06-18 10:43:28 +02:00
parent c0477a4d17
commit fb0c57659b
2 changed files with 19 additions and 2 deletions

View File

@ -1,2 +1,4 @@
# HandieBot # HandieBot
Discord Bot for music and other utilities, built with Discord4J and Lavaplayer Discord Bot for music and other utilities, built with Discord4J and Lavaplayer.

View File

@ -6,6 +6,8 @@ import sx.blah.discord.handle.impl.events.guild.channel.message.MessageReceivedE
import sx.blah.discord.handle.obj.*; import sx.blah.discord.handle.obj.*;
import sx.blah.discord.util.EmbedBuilder; import sx.blah.discord.util.EmbedBuilder;
import java.awt.*;
/** /**
* @author Andrew Lalis * @author Andrew Lalis
* Class to process commands. * Class to process commands.
@ -35,7 +37,7 @@ public class CommandHandler {
if (command.equals("play") && args.length == 1){ if (command.equals("play") && args.length == 1){
this.bot.loadAndPlay(channel, args[0]); this.bot.loadAndPlay(channel, args[0]);
} else if (command.equals("help")){ } else if (command.equals("help")){
this.sendHelpInfo(user);
} }
} }
} }
@ -71,10 +73,23 @@ public class CommandHandler {
return new String[0]; return new String[0];
} }
/**
* Method to send a useful list of commands to any user if they desire.
* @param user The user to send the message to.
*/
private void sendHelpInfo(IUser user){ private void sendHelpInfo(IUser user){
IPrivateChannel pm = user.getOrCreatePMChannel(); IPrivateChannel pm = user.getOrCreatePMChannel();
EmbedBuilder builder = new EmbedBuilder(); EmbedBuilder builder = new EmbedBuilder();
builder.withAuthorName("HandieBot");
builder.withAuthorUrl("https://github.com/andrewlalis/HandieBot");
builder.withAuthorIcon("https://github.com/andrewlalis/HandieBot/blob/master/src/main/resources/icon.png");
builder.withColor(new Color(255, 0, 0));
builder.withDescription("I'm a discord bot that can manage music, as well as some other important functions which will be implemented later on. Some commands are shown below.");
builder.appendField("Commands:", "play, skip, help", false);
pm.sendMessage(builder.build());
} }
/** /**