From 7d29ff727e4cdc01effe6615d1da9e8fb8089ea5 Mon Sep 17 00:00:00 2001 From: MrKrucible Date: Sat, 10 Jan 2015 15:15:12 -0800 Subject: [PATCH 1/4] 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. From 888215a82858a8e4a3add25f5aa4d0046ae299c2 Mon Sep 17 00:00:00 2001 From: MrKrucible Date: Sat, 10 Jan 2015 15:21:27 -0800 Subject: [PATCH 2/4] Add numsongs to HELP_MSG string. --- strings.go | 1 + 1 file changed, 1 insertion(+) diff --git a/strings.go b/strings.go index ad11fbf..735d070 100644 --- a/strings.go +++ b/strings.go @@ -88,6 +88,7 @@ const HELP_MSG = `

!help - Displays this help.

!add - Adds songs to queue.

!skip - Casts a vote to skip the current song

+

!numsongs - Shows how many songs are in queue.

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


Admin Commands:

From 55752a1a8b6248188d445178540ee3e835eb83ef Mon Sep 17 00:00:00 2001 From: MrKrucible Date: Sat, 10 Jan 2015 15:23:24 -0800 Subject: [PATCH 3/4] Update README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e374403..ef4eceb 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ An admin command that forces a song skip. ####`!forceskipplaylist` An admin command that forces a playlist skip. +####`!help` +Displays a this list of commands for you in Mumble chat. + ####`!volume ?` Either outputs the current volume or changes the current volume. If `desired_volume` is not provided, the current volume will be displayed in chat. Otherwise, the volume for the bot will be changed to `desired_volume` if it is within the allowed volume range. From ed51d58f0fb886a8dc75aeffdd494b31f6a52f23 Mon Sep 17 00:00:00 2001 From: MrKrucible Date: Sat, 10 Jan 2015 15:25:07 -0800 Subject: [PATCH 4/4] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4d4c2..ed09727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ MumbleDJ Changelog * Fixed type mismatch error when building MumbleDJ. * Added traversal function to SongQueue. * Added !numsongs command, which outputs how many songs are currently in the SongQueue. +* Added !help command, which displays a list of valid commands in Mumble chat. ### January 9, 2015 -- `v2.2.5` * Fixed some YouTube playlist URLs crashing the bot and not retrieving metadata correctly.