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

add chat.script

This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-21 10:08:12 +08:00
parent aa9624d62e
commit 5d8cfa9138
3 changed files with 44 additions and 0 deletions

View File

@ -31,6 +31,9 @@ func init() {
return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0])) return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0]))
}, arg...) }, arg...)
}}, }},
nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd(SCRIPT, mdb.INSERT, mdb.ZONE, "default", ctx.INDEX, arg[0], ice.AUTO, arg[2])
}},
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) { ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
_footer_plugin(m, ctx.CONFIG, arg, arg...) _footer_plugin(m, ctx.CONFIG, arg, arg...)
}}, }},

22
core/chat/script.go Normal file
View File

@ -0,0 +1,22 @@
package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/mdb"
)
const SCRIPT = "script"
func init() {
Index.MergeCommands(ice.Commands{
SCRIPT: {Name: "script zone id auto", Help: "脚本", Actions: ice.MergeActions(mdb.ZoneAction(mdb.FIELDS, "time,index,auto")), Hand: func(m *ice.Message, arg ...string) {
mdb.ZoneSelect(m, arg...)
m.Display("")
if len(arg) == 0 {
m.PushAction("play", mdb.REMOVE)
} else {
m.Action("play")
}
}},
})
}

19
core/chat/script.js Normal file
View File

@ -0,0 +1,19 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onappend.table(can, msg)
can.onappend.board(can, msg)
},
})
Volcanos(chat.ONACTION, {
play: function(event, can) {
can.core.Next(can._msg.Table(), function(value, next) {
var done = false
can.onappend.plugin(can, {index: value.index}, function(sub) {
can.onmotion.delay(can, function() {
if (!sub._auto) { sub.Update({}, [ctx.ACTION, value.auto], function() { next() }) }
}, 300)
sub.onexport.output = function() { done || sub.Update({}, [ctx.ACTION, value.auto], function() { next() }), done = true }
})
})
},
})