1
0
forked from x/icebergs
icebergs/core/chat/script.go
2024-01-22 22:24:08 +08:00

25 lines
744 B
Go

package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
)
const SCRIPT = "script"
func init() {
Index.MergeCommands(ice.Commands{
SCRIPT: {Name: "script zone id auto", Help: "脚本化", Icon: "script.png", Actions: ice.MergeActions(
mdb.ExportZoneAction(mdb.FIELDS, "time,id,space,index,play,status,style"),
), Hand: func(m *ice.Message, arg ...string) {
if mdb.ZoneSelect(m.Options(mdb.CACHE_LIMIT, "30"), arg...).Display(""); len(arg) == 0 {
m.PushAction(cli.RECORD, mdb.REMOVE).Action(mdb.CREATE, cli.STOP)
} else {
m.Sort(mdb.ID, ice.INT).PushAction(web.PREVIEW).Action(mdb.INSERT, cli.PLAY)
}
}},
})
}