1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00

opt grant

This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-01-03 11:32:37 +08:00
parent a15365fbb0
commit c7d8d33e2c

30
core/chat/grant.go Normal file
View File

@ -0,0 +1,30 @@
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"))},
}})
}