admin: forbid better

This commit is contained in:
Chris Sexton 2020-05-01 12:31:27 -04:00 committed by Chris Sexton
parent 8d775e95f2
commit 07c4950b2d
1 changed files with 7 additions and 1 deletions

View File

@ -108,8 +108,14 @@ func (p *AdminPlugin) message(conn bot.Connector, k bot.Kind, message msg.Messag
return true return true
} }
verbs := map[string]bool{
"set": true,
"push": true,
"setkey": true,
}
parts := strings.Split(body, " ") parts := strings.Split(body, " ")
if parts[0] == "set" && len(parts) > 2 && forbiddenKeys[parts[1]] { if verbs[parts[0]] && len(parts) > 2 && forbiddenKeys[parts[1]] {
p.bot.Send(conn, bot.Message, message.Channel, "You cannot access that key") p.bot.Send(conn, bot.Message, message.Channel, "You cannot access that key")
return true return true
} else if parts[0] == "unset" && len(parts) > 1 { } else if parts[0] == "unset" && len(parts) > 1 {