mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
🎨 改进代码结构
This commit is contained in:
parent
a8c3cf96b8
commit
cdf8ff4066
@ -121,7 +121,7 @@ func init() {
|
||||
)
|
||||
})
|
||||
|
||||
zero.OnRegex(`>runcode\s(.+?)\s([\s\S]+)`).SetBlock(true).SecondPriority().
|
||||
zero.OnRegex(`^>runcode\s(.+?)\s([\s\S]+)$`).SetBlock(true).SecondPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
language := ctx.State["regex_matched"].([]string)[1]
|
||||
language = strings.ToLower(language)
|
||||
@ -144,11 +144,15 @@ func init() {
|
||||
// 执行运行
|
||||
block := ctx.State["regex_matched"].([]string)[2]
|
||||
block = message.UnescapeCQCodeText(block)
|
||||
if block == "help"{
|
||||
|
||||
if block == "help" {
|
||||
//输出模板
|
||||
ctx.SendChain(
|
||||
message.Text("> ", ctx.Event.Sender.NickName, " ", language, "-template:\n"),
|
||||
message.Text(templates[language]),
|
||||
message.Text(
|
||||
">runcode ", language, "\n",
|
||||
templates[language],
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user