Add help command.

This commit is contained in:
MrKrucible 2015-01-10 15:15:12 -08:00
parent 25a5cb327b
commit 7d29ff727e
4 changed files with 39 additions and 0 deletions

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,23 @@ 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>!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>.