Compare commits

..

2 Commits

Author SHA1 Message Date
Chris Sexton 1488033c52 why is this file here? 2022-07-28 17:51:42 -04:00
Chris Sexton ad3b264a89 roles: make toggle case insensitive 2022-07-28 17:51:42 -04:00
2 changed files with 1 additions and 6 deletions

View File

@ -25,7 +25,6 @@ func New(b bot.Bot) *RolesPlugin {
c: b.Config(), c: b.Config(),
db: b.DB(), db: b.DB(),
} }
p.RegisterWeb()
p.Register() p.Register()
return p return p
} }
@ -78,7 +77,7 @@ func (p *RolesPlugin) toggleRole(r bot.Request) bool {
return true return true
} }
for _, rr := range roles { for _, rr := range roles {
if rr.Name == role { if strings.ToLower(rr.Name) == strings.ToLower(role) {
if err = r.Conn.SetRole(r.Msg.User.ID, rr.ID); err != nil { if err = r.Conn.SetRole(r.Msg.User.ID, rr.ID); err != nil {
log.Error().Err(err).Msg("setRole") log.Error().Err(err).Msg("setRole")
p.b.Send(r.Conn, bot.Message, r.Msg.Channel, "I couldn't set that role.") p.b.Send(r.Conn, bot.Message, r.Msg.Channel, "I couldn't set that role.")

View File

@ -1,4 +0,0 @@
package roles
func (p *RolesPlugin) RegisterWeb() {
}