Add bot restart/kill command
parent
202d852b1b
commit
636b5d4bb6
16
commands.go
16
commands.go
|
@ -5,7 +5,9 @@ import (
|
|||
"github.com/bwmarrin/disgord/x/mux"
|
||||
"github.com/nishanths/go-xkcd"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
)
|
||||
|
@ -84,3 +86,17 @@ func getXKCD(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
|
|||
resp = comic.ImageURL
|
||||
s.ChannelMessageSend(m.ChannelID, resp)
|
||||
}
|
||||
|
||||
//Restart the bot
|
||||
func restartBot(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
|
||||
if !checkRole(s, m, ctx, os.Getenv("POCKETBOT_ADMIN_ROLE")) {
|
||||
resp := "OwO you aren't my daddy..."
|
||||
s.ChannelMessageSend(m.ChannelID, resp)
|
||||
return
|
||||
}
|
||||
resp := "Goodnight ;-;"
|
||||
s.ChannelMessageSend(m.ChannelID, resp)
|
||||
Session.Close()
|
||||
log.Println("brb dying at the request of ", m.Author.String())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ func main() {
|
|||
Router.Route("monday", "It's Maki Monday my dudes!", makiMonday)
|
||||
Router.Route("mixes", "Post the link to my fire mixtapes!", postMixes)
|
||||
Router.Route("xkcd", "Post a specific, random, or the latest XKCD comic", getXKCD)
|
||||
Router.Route("restart", "Restart the bot.", restartBot)
|
||||
|
||||
//Open a connection to Discord
|
||||
err = Session.Open()
|
||||
|
|
Loading…
Reference in New Issue