Move bot admin role to be a global variable.

pull/20/head
pocketjawa 2020-04-26 02:57:21 -04:00
parent c2142bb741
commit be4b4e06de
2 changed files with 5 additions and 1 deletions

View File

@ -122,7 +122,7 @@ func getXKCD(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
//Restart the bot //Restart the bot
func restartBot(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) { func restartBot(s *discordgo.Session, m *discordgo.Message, ctx *mux.Context) {
if !checkRole(s, m, ctx, os.Getenv("POCKETBOT_ADMIN_ROLE")) { if !checkRole(s, m, ctx, bot_admin_role) {
resp := "OwO you aren't my daddy..." resp := "OwO you aren't my daddy..."
s.ChannelMessageSend(m.ChannelID, resp) s.ChannelMessageSend(m.ChannelID, resp)
return return

View File

@ -16,6 +16,7 @@ import (
var Session, _ = discordgo.New() var Session, _ = discordgo.New()
var bot_token string var bot_token string
var bot_channel string var bot_channel string
var bot_admin_role string
var Router = mux.New() var Router = mux.New()
func init() { func init() {
@ -31,6 +32,9 @@ func init() {
if os.Getenv("DISCORD_BOT_CHANNEL") != "" { if os.Getenv("DISCORD_BOT_CHANNEL") != "" {
bot_channel = os.Getenv("DISCORD_BOT_CHANNEL") bot_channel = os.Getenv("DISCORD_BOT_CHANNEL")
} }
if os.Getenv("POCKETBOT_ADMIN_ROLE") != "" {
bot_admin_role = os.Getenv("POCKETBOT_ADMIN_ROLE")
}
} }
func main() { func main() {