mirror of https://github.com/velour/catbase.git
config: add push command
* you can now run `push <setting> <value>` to add values to a setting
This commit is contained in:
parent
4275619e49
commit
81cc0dc55b
|
@ -104,7 +104,17 @@ func (p *AdminPlugin) message(conn bot.Connector, k bot.Kind, message msg.Messag
|
||||||
}
|
}
|
||||||
p.bot.Send(conn, bot.Message, message.Channel, fmt.Sprintf("Set %s", parts[1]))
|
p.bot.Send(conn, bot.Message, message.Channel, fmt.Sprintf("Set %s", parts[1]))
|
||||||
return true
|
return true
|
||||||
|
} else if parts[0] == "push" && len(parts) > 2 {
|
||||||
|
items := p.cfg.GetArray(parts[1], []string{})
|
||||||
|
items = append(items, strings.Join(parts[2:], ""))
|
||||||
|
if err := p.cfg.Set(parts[1], strings.Join(items, ";;")); err != nil {
|
||||||
|
p.bot.Send(conn, bot.Message, message.Channel, fmt.Sprintf("Set error: %s", err))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
p.bot.Send(conn, bot.Message, message.Channel, fmt.Sprintf("Set %s", parts[1]))
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if parts[0] == "get" && len(parts) == 2 && forbiddenKeys[parts[1]] {
|
if parts[0] == "get" && 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
|
||||||
|
|
Loading…
Reference in New Issue