From 7d29ff727e4cdc01effe6615d1da9e8fb8089ea5 Mon Sep 17 00:00:00 2001 From: MrKrucible Date: Sat, 10 Jan 2015 15:15:12 -0800 Subject: [PATCH] Add help command. --- commands.go | 12 ++++++++++++ mumbledj.gcfg | 8 ++++++++ parseconfig.go | 2 ++ strings.go | 17 +++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/commands.go b/commands.go index 4fdd055..c0219b3 100644 --- a/commands.go +++ b/commands.go @@ -67,6 +67,13 @@ func parseCommand(user *gumble.User, username, command string) { } else { user.Send(NO_PERMISSION_MSG) } + // Help command + case dj.conf.Aliases.HelpAlias: + if dj.HasPermission(username, dj.conf.Permissions.AdminHelp) { + help(user) + } else { + user.Send(NO_PERMISSION_MSG) + } // Volume command case dj.conf.Aliases.VolumeAlias: if dj.HasPermission(username, dj.conf.Permissions.AdminVolume) { @@ -232,6 +239,11 @@ func skip(user *gumble.User, username string, admin, playlistSkip bool) { } } +//Preforms help functionality. Displays a list of valid commands. +func help(user *gumble.User) { + user.Send(HELP_MSG) +} + // Performs volume functionality. Checks input value against LowestVolume and HighestVolume from // config to determine if the volume should be applied. If in the correct range, the new volume // is applied and is immediately in effect. diff --git a/mumbledj.gcfg b/mumbledj.gcfg index f9be6cc..70dd6ff 100644 --- a/mumbledj.gcfg +++ b/mumbledj.gcfg @@ -51,6 +51,10 @@ SkipPlaylistAlias = "skipplaylist" # DEFAULT VALUE: "forceskip" AdminSkipAlias = "forceskip" +# Alias used for help command +# DEFAULT VALUE: "help" +HelpAlias = "help" + # Alias used for volume command # DEFAULT VALUE: "volume" VolumeAlias = "volume" @@ -103,6 +107,10 @@ AdminAddPlaylists = false # DEFAULT VALUE: false AdminSkip = false +# Make help an admin command? +# DEFAULT VALUE: false +AdminHelp = false + # Make volume an admin command? # DEFAULT VALUE: false AdminVolume = false diff --git a/parseconfig.go b/parseconfig.go index 3a0e2be..f6fbf01 100644 --- a/parseconfig.go +++ b/parseconfig.go @@ -31,6 +31,7 @@ type DjConfig struct { SkipPlaylistAlias string AdminSkipAlias string AdminSkipPlaylistAlias string + HelpAlias string VolumeAlias string MoveAlias string ReloadAlias string @@ -44,6 +45,7 @@ type DjConfig struct { AdminAdd bool AdminAddPlaylists bool AdminSkip bool + AdminHelp bool AdminVolume bool AdminMove bool AdminReload bool diff --git a/strings.go b/strings.go index ef9b947..ad11fbf 100644 --- a/strings.go +++ b/strings.go @@ -82,6 +82,23 @@ const PLAYLIST_SKIPPED_HTML = ` The number of votes required for a skip has been met. Skipping playlist! ` +// Message shown to display bot help commands. +const HELP_MSG = ` + User Commands: +

!help - Displays this help.

+

!add - Adds songs to queue.

+

!skip - Casts a vote to skip the current song

+

!skipplaylist - Casts a vote to skip over the current playlist.

+


+

Admin Commands:

+

!reset - An admin command that resets the song queue.

+

!forceskip - An admin command that forces a song skip.

+

!forceskipplaylist - An admin command that forces a playlist skip.

+

!move - Moves MumbleDJ into channel if it exists.

+

!reload - Reloads mumbledj.gcfg configuration settings.

+

!kill - Safely cleans the bot environment and disconnects from the server.

+` + // Message shown to users when they ask for the current volume (volume command without argument) const CUR_VOLUME_HTML = ` The current volume is %.2f.