From 780705840a868f0b776c9f18832996ea67e70aa3 Mon Sep 17 00:00:00 2001 From: Matt Kohls Date: Sat, 14 Apr 2018 15:33:33 -0400 Subject: Help Command Adding ~help command so people can find out what the bot can do --- src/main/java/soundchan/BotListener.java | 21 +++++++++++++++++++++ src/main/java/soundchan/Commands.java | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/soundchan/BotListener.java b/src/main/java/soundchan/BotListener.java index 8785892..02170af 100644 --- a/src/main/java/soundchan/BotListener.java +++ b/src/main/java/soundchan/BotListener.java @@ -15,6 +15,7 @@ import net.dv8tion.jda.core.events.guild.voice.GuildVoiceMoveEvent; import net.dv8tion.jda.core.events.message.MessageReceivedEvent; import net.dv8tion.jda.core.hooks.ListenerAdapter; import net.dv8tion.jda.core.managers.AudioManager; +import net.dv8tion.jda.core.managers.ChannelManager; import java.util.HashMap; import java.util.List; @@ -143,6 +144,10 @@ public class BotListener extends ListenerAdapter{ connectToUserVoiceChannel(guild.getAudioManager(), event.getMember().getEffectiveName()); break; } + case help: { + help(channel); + break; + } } } @@ -237,6 +242,22 @@ public class BotListener extends ListenerAdapter{ channel.sendMessage("Skipped to next track.").queue(); } + private void help(final MessageChannel channel) { + String printMessage = "List of commands:\n ```" + + "! - plays a sound\n" + + "~play - plays audio from link\n" + + "~volume # - sets the volume to the number as a percentage \n" + + "~pause - pauses the playing audio\n" + + "~unpause - unpauses the audio\n" + + "~skip - skips to the next song in queue\n" + + "~list queue - prints out the names of the songs in the queue\n" + + "~list sounds - prints out the names of the sounds available\n" + + "~playingnow - prints out the name of the currently playing song\n" + + "~summon - brings SoundChan to the voice channel of the summoner\n" + + "~help - prints out this help message ```"; + channel.sendMessage(printMessage).queue(); + } + private static void connectToFollowingVoiceChannel(AudioManager audioManager) { if(!audioManager.isConnected()) { diff --git a/src/main/java/soundchan/Commands.java b/src/main/java/soundchan/Commands.java index 45fda7a..e6ccf0e 100644 --- a/src/main/java/soundchan/Commands.java +++ b/src/main/java/soundchan/Commands.java @@ -11,5 +11,6 @@ public enum Commands { skip, list, playingnow, - summon + summon, + help } -- cgit v1.2.3