1
0
forked from x/icebergs
icebergs/core/chat/grant.go
2022-01-03 11:32:37 +08:00

31 lines
1.0 KiB
Go

package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
)
const GRANT = "grant"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
GRANT: {Name: "grant space id auto insert", Help: "授权", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case web.SPACE:
m.Cmdy(web.SPACE).RenameAppend(mdb.NAME, web.SPACE).Cut("space,type")
case GRANT:
m.Cmdy(web.SPACE, m.Option(web.SPACE), web.SPACE).RenameAppend(mdb.NAME, GRANT).Cut("grant,type")
case aaa.USERROLE:
m.Push(arg[0], m.Option(ice.MSG_USERROLE))
case aaa.USERNAME:
m.Push(arg[0], m.Option(ice.MSG_USERNAME))
}
}},
mdb.INSERT: {Name: "insert space grant userrole username", Help: "添加"},
}, mdb.ZoneAction(mdb.SHORT, web.SPACE, mdb.FIELD, "time,grant,userrole,username"))},
}})
}