diff --git a/bot/bot.go b/bot/bot.go index d6f19ec..02936f3 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -260,11 +260,11 @@ func IsCmd(c *config.Config, message string) (bool, string) { return iscmd, message } -func (b *bot) CheckAdmin(nick string) bool { +func (b *bot) CheckAdmin(ID string) bool { admins := b.Config().GetArray("Admins", []string{}) - log.Info().Interface("admins", admins).Msgf("Checking admin for %s", nick) + log.Info().Interface("admins", admins).Msgf("Checking admin for %s", ID) for _, u := range admins { - if nick == u { + if ID == u { log.Info().Msg("%s admin check: passed") return true } diff --git a/plugins/admin/admin.go b/plugins/admin/admin.go index 6660f0b..95a7dad 100644 --- a/plugins/admin/admin.go +++ b/plugins/admin/admin.go @@ -109,7 +109,7 @@ var getConfigRegex = regexp.MustCompile(`(?i)^get (?P\S+)$`) func (p *AdminPlugin) isAdmin(rh bot.ResponseHandler) bot.ResponseHandler { return func(r bot.Request) bool { - if !p.bot.CheckAdmin(r.Msg.User.Name) { + if !p.bot.CheckAdmin(r.Msg.User.ID) { log.Debug().Msgf("User %s is not an admin", r.Msg.User.Name) return false } diff --git a/plugins/first/first.go b/plugins/first/first.go index d99ceb7..a689574 100644 --- a/plugins/first/first.go +++ b/plugins/first/first.go @@ -179,7 +179,7 @@ func (p *FirstPlugin) register() { {Kind: bot.Message, IsCmd: true, Regex: regexp.MustCompile(`(?i)^clear first$`), Handler: func(r bot.Request) bool { - if !p.bot.CheckAdmin(r.Msg.User.Name) { + if !p.bot.CheckAdmin(r.Msg.User.ID) { p.bot.Send(r.Conn, bot.Message, r.Msg.Channel, "You are not authorized to do that.") return true } diff --git a/plugins/roles/roles.go b/plugins/roles/roles.go index 148ed26..cecbb82 100644 --- a/plugins/roles/roles.go +++ b/plugins/roles/roles.go @@ -124,7 +124,7 @@ func (p *RolesPlugin) lsRoles(r bot.Request) bool { } func (p *RolesPlugin) setOffering(r bot.Request) bool { - if !p.b.CheckAdmin(r.Msg.User.Name) { + if !p.b.CheckAdmin(r.Msg.User.ID) { p.b.Send(r.Conn, bot.Message, r.Msg.Channel, "You must be an admin to set an offering.") return true }