mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-20 06:20:08 +08:00
🎨 改进代码结构
This commit is contained in:
parent
af0332f454
commit
45a2808c13
@ -18,28 +18,29 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
zero.OnRegex("^酷我点歌(.+?)$").SetBlock(true).FirstPriority().
|
zero.OnRegex("^酷我点歌(.+?)$").SetBlock(true).FirstPriority().
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
ctx.Send(kuwo(ctx.State["regex_matched"].([]string)[1]))
|
ctx.SendChain(kuwo(ctx.State["regex_matched"].([]string)[1]))
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
zero.OnRegex("^酷狗点歌(.+?)$").SetBlock(true).SetPriority(50).Handle(func(ctx *zero.Ctx) {
|
zero.OnRegex("^酷狗点歌(.+?)$").SetBlock(true).FirstPriority().
|
||||||
ctx.Send(kugou(ctx.State["regex_matched"].([]string)[1]))
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
ctx.SendChain(kugou(ctx.State["regex_matched"].([]string)[1]))
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
zero.OnRegex("^网易点歌(.+?)$").SetBlock(true).SetPriority(50).Handle(func(ctx *zero.Ctx) {
|
zero.OnRegex("^网易点歌(.+?)$").SetBlock(true).FirstPriority().
|
||||||
ctx.Send(cloud163(ctx.State["regex_matched"].([]string)[1]))
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
ctx.SendChain(cloud163(ctx.State["regex_matched"].([]string)[1]))
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
||||||
zero.OnRegex("^点歌(.+?)$").SetBlock(true).SetPriority(50).Handle(func(ctx *zero.Ctx) {
|
zero.OnRegex("^点歌(.+?)$").SetBlock(true).FirstPriority().
|
||||||
ctx.Send(qqmusic(ctx.State["regex_matched"].([]string)[1]))
|
Handle(func(ctx *zero.Ctx) {
|
||||||
|
ctx.SendChain(qqmusic(ctx.State["regex_matched"].([]string)[1]))
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// kuwo 返回酷我音乐卡片
|
// kuwo 返回酷我音乐卡片
|
||||||
func kuwo(keyword string) message.MessageSegment {
|
func kuwo(keyword string) message.MessageSegment {
|
||||||
headers := http.Header{
|
headers := http.Header{
|
||||||
@ -193,8 +194,6 @@ func qqmusic(keyword string) message.MessageSegment {
|
|||||||
).Add("content", info.Get("singer.0.name").Str).Add("image", image)
|
).Add("content", info.Get("singer.0.name").Str).Add("image", image)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// find 返回 pre 到 suf 之间的文本
|
// find 返回 pre 到 suf 之间的文本
|
||||||
func find(pre string, suf string, str string) string {
|
func find(pre string, suf string, str string) string {
|
||||||
n := strings.Index(str, pre)
|
n := strings.Index(str, pre)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user