MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / init

Function init

plugin/moegozh/main.go:27–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27func init() {
28 en := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
29 DisableOnDefault: false,
30 Brief: "VITS模型拟声迫真中文",
31 Help: "- 让[宁宁|爱瑠|芳乃|茉子|丛雨|小春|七海]用中文说(中文)\n" +
32 "- 让[수아|미미르|아린|연화|유화|선배]用中文说(中文)",
33 }).ApplySingle(ctxext.DefaultSingle)
34 en.OnRegex("^让(宁宁|爱瑠|芳乃|茉子|丛雨|小春|七海)用中文说([A-Za-z\\s\\d\u4E00-\u9FA5.。,,、::;;]+)$").Limit(ctxext.LimitByGroup).SetBlock(true).
35 Handle(func(ctx *zero.Ctx) {
36 text := ctx.State["regex_matched"].([]string)[2]
37 id := speakers[ctx.State["regex_matched"].([]string)[1]]
38 text = gofyzhq.Transform(text, "jp")
39 // ctx.SendChain(message.Text("转换结果: ", text))
40 ctx.SendChain(message.Record(fmt.Sprintf(jpapi, url.QueryEscape(text), id)))
41 })
42 en.OnRegex("^让(수아|미미르|아린|연화|유화|선배)用中文说([A-Za-z\\s\\d\u4E00-\u9FA5.。,,、::;;]+)$").Limit(ctxext.LimitByGroup).SetBlock(true).
43 Handle(func(ctx *zero.Ctx) {
44 text := ctx.State["regex_matched"].([]string)[2]
45 id := speakers[ctx.State["regex_matched"].([]string)[1]]
46 text = gofyzhq.Transform(text, "kr")
47 ctx.SendChain(message.Record(fmt.Sprintf(krapi, url.QueryEscape(text), id)))
48 })
49}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected