Merge pull request #18 from MrKrucible/master

Add !help command
This commit is contained in:
Matthieu Grieger 2015-01-10 16:09:14 -08:00
commit ca71c9cfea
6 changed files with 44 additions and 0 deletions

View file

@ -5,6 +5,7 @@ MumbleDJ Changelog
* Fixed type mismatch error when building MumbleDJ. * Fixed type mismatch error when building MumbleDJ.
* Added traversal function to SongQueue. * Added traversal function to SongQueue.
* Added !numsongs command, which outputs how many songs are currently in the 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` ### January 9, 2015 -- `v2.2.5`
* Fixed some YouTube playlist URLs crashing the bot and not retrieving metadata correctly. * Fixed some YouTube playlist URLs crashing the bot and not retrieving metadata correctly.

View file

@ -27,6 +27,9 @@ An admin command that forces a song skip.
####`!forceskipplaylist` ####`!forceskipplaylist`
An admin command that forces a playlist skip. An admin command that forces a playlist skip.
####`!help`
Displays a this list of commands for you in Mumble chat.
####`!volume <desired_volume>?` ####`!volume <desired_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. 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.

View file

@ -67,6 +67,13 @@ func parseCommand(user *gumble.User, username, command string) {
} else { } else {
user.Send(NO_PERMISSION_MSG) 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 // Volume command
case dj.conf.Aliases.VolumeAlias: case dj.conf.Aliases.VolumeAlias:
if dj.HasPermission(username, dj.conf.Permissions.AdminVolume) { 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 // 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 // config to determine if the volume should be applied. If in the correct range, the new volume
// is applied and is immediately in effect. // is applied and is immediately in effect.

View file

@ -51,6 +51,10 @@ SkipPlaylistAlias = "skipplaylist"
# DEFAULT VALUE: "forceskip" # DEFAULT VALUE: "forceskip"
AdminSkipAlias = "forceskip" AdminSkipAlias = "forceskip"
# Alias used for help command
# DEFAULT VALUE: "help"
HelpAlias = "help"
# Alias used for volume command # Alias used for volume command
# DEFAULT VALUE: "volume" # DEFAULT VALUE: "volume"
VolumeAlias = "volume" VolumeAlias = "volume"
@ -103,6 +107,10 @@ AdminAddPlaylists = false
# DEFAULT VALUE: false # DEFAULT VALUE: false
AdminSkip = false AdminSkip = false
# Make help an admin command?
# DEFAULT VALUE: false
AdminHelp = false
# Make volume an admin command? # Make volume an admin command?
# DEFAULT VALUE: false # DEFAULT VALUE: false
AdminVolume = false AdminVolume = false

View file

@ -31,6 +31,7 @@ type DjConfig struct {
SkipPlaylistAlias string SkipPlaylistAlias string
AdminSkipAlias string AdminSkipAlias string
AdminSkipPlaylistAlias string AdminSkipPlaylistAlias string
HelpAlias string
VolumeAlias string VolumeAlias string
MoveAlias string MoveAlias string
ReloadAlias string ReloadAlias string
@ -44,6 +45,7 @@ type DjConfig struct {
AdminAdd bool AdminAdd bool
AdminAddPlaylists bool AdminAddPlaylists bool
AdminSkip bool AdminSkip bool
AdminHelp bool
AdminVolume bool AdminVolume bool
AdminMove bool AdminMove bool
AdminReload bool AdminReload bool

View file

@ -82,6 +82,24 @@ const PLAYLIST_SKIPPED_HTML = `
The number of votes required for a skip has been met. <b>Skipping playlist!</b> The number of votes required for a skip has been met. <b>Skipping playlist!</b>
` `
// Message shown to display bot help commands.
const HELP_MSG = `
<b>User Commands:</b>
<p><b>!help</b> - Displays this help.</p>
<p><b>!add </b>- Adds songs to queue.</p>
<p><b>!skip</b> - Casts a vote to skip the current song</p>
<p><b>!numsongs</b> - Shows how many songs are in queue.</p>
<p> <b>!skipplaylist</b> - Casts a vote to skip over the current playlist.</p>
<p style="-qt-paragraph-type:empty"><br/></p>
<p><b>Admin Commands:</b></p>
<p><b>!reset</b> - An admin command that resets the song queue. </p>
<p><b>!forceskip</b> - An admin command that forces a song skip. </p>
<p><b>!forceskipplaylist</b> - An admin command that forces a playlist skip. </p>
<p><b>!move </b>- Moves MumbleDJ into channel if it exists.</p>
<p><b>!reload</b> - Reloads mumbledj.gcfg configuration settings.</p>
<p><b>!kill</b> - Safely cleans the bot environment and disconnects from the server.</p>
`
// Message shown to users when they ask for the current volume (volume command without argument) // Message shown to users when they ask for the current volume (volume command without argument)
const CUR_VOLUME_HTML = ` const CUR_VOLUME_HTML = `
The current volume is <b>%.2f</b>. The current volume is <b>%.2f</b>.