joinme feacture

This commit is contained in:
azlux 2016-06-17 18:15:11 +02:00
parent e133c0efcb
commit 73cdb8a247
4 changed files with 31 additions and 0 deletions

View file

@ -97,6 +97,13 @@ func parseCommand(user *gumble.User, username, command string) {
} else {
dj.SendPrivateMessage(user, NO_PERMISSION_MSG)
}
// JoinMe command
case dj.conf.Aliases.JoinMeAlias:
if dj.HasPermission(username, dj.conf.Permissions.AdminJoinMe) {
joinMe(user)
} else {
dj.SendPrivateMessage(user, NO_PERMISSION_MSG)
}
// Reload command
case dj.conf.Aliases.ReloadAlias:
if dj.HasPermission(username, dj.conf.Permissions.AdminReload) {
@ -347,6 +354,16 @@ func move(user *gumble.User, channel string) {
}
}
// move performance !joinme functionality. Found the channel and move the bot. The bot don't move
// if it already play music to people
func joinMe(user *gumble.User) {
if dj.audioStream.IsPlaying() && len(dj.client.Self.Channel.Users) > 1 {
user.Send(PEOPLE_ARE_LISTENING_TO_ME)
} else {
dj.client.Self.Move(user.Channel)
}
}
// reload performs !reload functionality. Tells command submitter if the reload completed successfully.
func reload(user *gumble.User) {
if err := loadConfiguration(); err == nil {

View file

@ -106,6 +106,10 @@ HelpAlias = "help"
# DEFAULT VALUE: "volume"
VolumeAlias = "volume"
Alias used for join a user
# DEFAULT VALUE : "joinme"
JoinMeAlias = "joinme"
# Alias used for move command
# DEFAULT VALUE: "move"
MoveAlias = "move"
@ -209,6 +213,10 @@ AdminVolume = false
# DEFAULT VALUE: true
AdminMove = true
# Make joinme a admin command?
# DEFUALT VALUE: true
AdminJoinMe = false
# Make reload an admin command?
# DEFAULT VALUE: true
AdminReload = true

View file

@ -47,6 +47,7 @@ type DjConfig struct {
HelpAlias string
VolumeAlias string
MoveAlias string
JoinMeAlias string
ReloadAlias string
ResetAlias string
NumSongsAlias string
@ -72,6 +73,7 @@ type DjConfig struct {
AdminHelp bool
AdminVolume bool
AdminMove bool
AdminJoinMe bool
AdminReload bool
AdminReset bool
AdminNumSongs bool

View file

@ -98,6 +98,9 @@ const SHUFFLE_ACTIVATED_ERROR_MESSAGE = "Automatic shuffle is already activated.
// Message shown to user when they attempt to disable automatic shuffle while it's already deactivated
const SHUFFLE_DEACTIVATED_ERROR_MESSAGE = "Automatic shuffle is already deactivated."
// Message show to user when they attempt to move it and it is already playing music to people
const PEOPLE_ARE_LISTENING_TO_ME = "I'm already busy."
// Message shown to channel when a song is added to the queue by a user.
const SONG_ADDED_HTML = `
<b>%s</b> has added "%s" to the queue.
@ -151,6 +154,7 @@ const HELP_HTML = `<br/>
<p><b>!shuffleon</b> - An admin command that enables auto shuffling.</p>
<p><b>!shuffleoff</b> - An admin command that disables auto shuffling.</p>
<p><b>!move </b>- Moves MumbleDJ into channel if it exists.</p>
<p><b>!joinme </b>- Move into your channel (MP)</p>
<p><b>!reload</b> - Reloads mumbledj.gcfg configuration settings.</p>
<p><b>!setcomment</b> - Sets the comment for the bot.</p>
<p><b>!numcached</b></p> - Outputs the number of songs cached on disk.</p>