Add setplaying command

pull/20/head
pocketjawa 2020-04-26 04:45:16 -04:00
parent 73e90c8e48
commit 3d6d093e87
2 changed files with 19 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"os" "os"
"regexp" "regexp"
"strconv" "strconv"
"strings"
) )
//Check member roles //Check member roles
@ -145,3 +146,20 @@ func goToSleep(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
} }
s.ChannelMessageSendEmbed(m.ChannelID, embed) s.ChannelMessageSendEmbed(m.ChannelID, embed)
} }
func setNowPlaying(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
if !checkRole(s, m, ctx, bot_admin_role) {
resp := "OwO you aren't my daddy..."
s.ChannelMessageSend(m.ChannelID, resp)
return
}
var resp string
if len(ctx.Fields) > 1 {
arg := strings.Join(ctx.Fields[1:], " ")
s.UpdateStatus(0, arg)
resp = "Now playing: " + arg
} else {
resp = "random"
}
s.ChannelMessageSend(m.ChannelID, resp)
}

View File

@ -68,6 +68,7 @@ func main() {
Router.Route("restart", "Restart the bot.", restartBot) Router.Route("restart", "Restart the bot.", restartBot)
Router.Route("kill", "Restart the bot.", restartBot) Router.Route("kill", "Restart the bot.", restartBot)
Router.Route("sleep", "Something about sleeping...", goToSleep) Router.Route("sleep", "Something about sleeping...", goToSleep)
Router.Route("setplaying", "Set the nowplaying message for the bot.", setNowPlaying)
//Open a connection to Discord //Open a connection to Discord
err = Session.Open() err = Session.Open()