mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 18:37:29 +08:00
opt chat.scan
This commit is contained in:
parent
7ae17111d8
commit
56233b5318
@ -423,6 +423,9 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
|||||||
f := m.Target().Server().(*Frame)
|
f := m.Target().Server().(*Frame)
|
||||||
f.printf(m, m.Cmdx(cli.PYTHON, "qrcode", strings.Join(arg, "")))
|
f.printf(m, m.Cmdx(cli.PYTHON, "qrcode", strings.Join(arg, "")))
|
||||||
}},
|
}},
|
||||||
|
"what": {Name: "return", Help: "结束脚本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
m.Echo(kit.MergeURL2(m.Conf(web.SHARE, "meta.domain"), "/chat/lark/sso"))
|
||||||
|
}},
|
||||||
RETURN: {Name: "return", Help: "结束脚本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
RETURN: {Name: "return", Help: "结束脚本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
switch cb := m.Optionv("ssh.return").(type) {
|
switch cb := m.Optionv("ssh.return").(type) {
|
||||||
case func():
|
case func():
|
||||||
|
@ -26,6 +26,11 @@ const (
|
|||||||
|
|
||||||
const LOCATION = "location"
|
const LOCATION = "location"
|
||||||
|
|
||||||
|
func _trans(arg []string, tr map[string]string) {
|
||||||
|
for i := 0; i < len(arg)-1; i += 2 {
|
||||||
|
arg[i] = kit.Select(arg[i], tr[arg[i]])
|
||||||
|
}
|
||||||
|
}
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
@ -33,7 +38,8 @@ func init() {
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
LOCATION: {Name: "location text auto 添加@location", Help: "地理位置", Action: map[string]*ice.Action{
|
LOCATION: {Name: "location text auto 添加@location", Help: "地理位置", Action: map[string]*ice.Action{
|
||||||
mdb.CREATE: {Name: "insert type name text latitude longitude", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "insert type name address latitude longitude", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_trans(arg, map[string]string{"address": "text"})
|
||||||
m.Conf(LOCATION, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
m.Conf(LOCATION, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
||||||
m.Cmdy(mdb.INSERT, LOCATION, m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
m.Cmdy(mdb.INSERT, LOCATION, m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -16,7 +16,8 @@ func init() {
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
PASTE: {Name: "paste hash auto 添加@paste", Help: "粘贴板", Action: map[string]*ice.Action{
|
PASTE: {Name: "paste hash auto 添加@paste", Help: "粘贴板", Action: map[string]*ice.Action{
|
||||||
mdb.INSERT: {Name: "insert text:textarea=hi", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Name: "insert data:textarea=hi", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_trans(arg, map[string]string{"data": "text"})
|
||||||
m.Conf(PASTE, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
m.Conf(PASTE, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
||||||
m.Cmdy(mdb.INSERT, m.Prefix(PASTE), m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
m.Cmdy(mdb.INSERT, m.Prefix(PASTE), m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -7,32 +7,32 @@ import (
|
|||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const QRCODE = "qrcode"
|
const SCAN = "scan"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
QRCODE: {Name: QRCODE, Help: "二维码", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TEXT)},
|
SCAN: {Name: SCAN, Help: "扫码", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TEXT)},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
QRCODE: {Name: "qrcode hash auto 添加@scan", Help: "二维码", Action: map[string]*ice.Action{
|
SCAN: {Name: "scan hash auto 添加@scan", Help: "扫码", Action: map[string]*ice.Action{
|
||||||
mdb.INSERT: {Name: "insert text:textarea=hi", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Name: "insert text:textarea=hi", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Conf(QRCODE, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
m.Conf(SCAN, kit.Keys(m.Option(ice.MSG_DOMAIN), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)
|
||||||
m.Cmdy(mdb.INSERT, m.Prefix(QRCODE), m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
m.Cmdy(mdb.INSERT, m.Prefix(SCAN), m.Option(ice.MSG_DOMAIN), mdb.HASH, arg)
|
||||||
}},
|
}},
|
||||||
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.DELETE, m.Prefix(QRCODE), m.Option(ice.MSG_DOMAIN), mdb.HASH, kit.MDB_TEXT, m.Option(kit.MDB_TEXT))
|
m.Cmdy(mdb.DELETE, m.Prefix(SCAN), m.Option(ice.MSG_DOMAIN), mdb.HASH, kit.MDB_TEXT, m.Option(kit.MDB_TEXT))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
text := m.Cmd(mdb.SELECT, m.Prefix(QRCODE), m.Option(ice.MSG_DOMAIN), mdb.HASH, kit.MDB_HASH, arg[0]).Append(kit.MDB_TEXT)
|
text := m.Cmd(mdb.SELECT, m.Prefix(SCAN), m.Option(ice.MSG_DOMAIN), mdb.HASH, kit.MDB_HASH, arg[0]).Append(kit.MDB_TEXT)
|
||||||
m.Cmdy(wiki.SPARK, "inner", text)
|
m.Cmdy(wiki.SPARK, "inner", text)
|
||||||
m.Cmdy(wiki.IMAGE, "qrcode", text)
|
m.Cmdy(wiki.IMAGE, "qrcode", text)
|
||||||
m.Render("")
|
m.Render("")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Cmdy(mdb.SELECT, m.Prefix(QRCODE), m.Option(ice.MSG_DOMAIN), mdb.HASH)
|
m.Cmdy(mdb.SELECT, m.Prefix(SCAN), m.Option(ice.MSG_DOMAIN), mdb.HASH)
|
||||||
m.Sort(kit.MDB_TIME, "time_r")
|
m.Sort(kit.MDB_TIME, "time_r")
|
||||||
m.PushAction("删除")
|
m.PushAction("删除")
|
||||||
}},
|
}},
|
||||||
|
@ -98,6 +98,9 @@ func init() {
|
|||||||
m.Option(web.SHARE, m.Cmdx(AUTH, mdb.CREATE, kit.MDB_TYPE, NODE))
|
m.Option(web.SHARE, m.Cmdx(AUTH, mdb.CREATE, kit.MDB_TYPE, NODE))
|
||||||
m.Cmdy(code.PUBLISH, "contexts", "tool")
|
m.Cmdy(code.PUBLISH, "contexts", "tool")
|
||||||
}},
|
}},
|
||||||
|
mdb.INSERT: {Name: "insert", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(mdb.INSERT, RIVER, kit.Keys(kit.MDB_HASH, m.Option(RIVER), NODE), mdb.HASH, arg)
|
||||||
|
}},
|
||||||
web.SPACE_START: {Name: "start type name share river", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
web.SPACE_START: {Name: "start type name share river", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(ice.MSG_RIVER, m.Option(RIVER)) == "" {
|
if m.Option(ice.MSG_RIVER, m.Option(RIVER)) == "" {
|
||||||
return
|
return
|
||||||
@ -261,9 +264,10 @@ func init() {
|
|||||||
_river_list(m)
|
_river_list(m)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(arg) > 1 && arg[1] == TOOL {
|
switch kit.Select("", arg, 1) {
|
||||||
|
case USER, TOOL, NODE:
|
||||||
m.Option(ice.MSG_RIVER, arg[0])
|
m.Option(ice.MSG_RIVER, arg[0])
|
||||||
m.Cmdy(TOOL, arg[2:])
|
m.Cmdy(m.Prefix(arg[1]), arg[2:])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !m.Warn(!m.Right(RIVER, arg), ice.ErrNotAuth) {
|
if !m.Warn(!m.Right(RIVER, arg), ice.ErrNotAuth) {
|
||||||
|
@ -32,4 +32,4 @@ var Index = &ice.Context{Name: WIKI, Help: "文档中心",
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { web.Index.Register(Index, &web.Frame{}) }
|
func init() { web.Index.Register(Index, &web.Frame{}, SPARK, IMAGE) }
|
||||||
|
@ -544,6 +544,7 @@ var Index = &ice.Context{Name: "lark", Help: "机器人",
|
|||||||
m.Richs(APP, nil, "bot", func(key string, value map[string]interface{}) {
|
m.Richs(APP, nil, "bot", func(key string, value map[string]interface{}) {
|
||||||
m.Render("redirect", kit.MergeURL2(m.Conf(APP, "meta.lark"), "/open-apis/authen/v1/index"),
|
m.Render("redirect", kit.MergeURL2(m.Conf(APP, "meta.lark"), "/open-apis/authen/v1/index"),
|
||||||
"app_id", value["id"], "redirect_uri", kit.MergeURL2(m.Conf(web.SHARE, "meta.domain"), "/chat/lark/sso"),
|
"app_id", value["id"], "redirect_uri", kit.MergeURL2(m.Conf(web.SHARE, "meta.domain"), "/chat/lark/sso"),
|
||||||
|
// "app_id", value["id"], "redirect_uri", "https://shylinux.com/chat/lark/sso",
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user