mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-23 18:00:07 +08:00
35 lines
667 B
Go
35 lines
667 B
Go
package setutime
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"bot/music/utils"
|
|
|
|
zero "github.com/wdvxdr1123/ZeroBot"
|
|
)
|
|
|
|
func init() { // 插件主体
|
|
// TODO 根据PID搜图
|
|
zero.OnRegex(`^点歌(.*)$`).SetBlock(true).SetPriority(50).
|
|
Handle(func(ctx *zero.Ctx) {
|
|
music, err := utils.CloudMusic(ctx.State["regex_matched"].([]string)[1])
|
|
if err != nil {
|
|
ctx.Send(fmt.Sprintf("ERROR: %v", err))
|
|
return
|
|
}
|
|
// TODO 发送搜索结果
|
|
ctx.Send(
|
|
fmt.Sprintf(
|
|
"[CQ:music,type=%s,url=%s,audio=%s,title=%s,content=%s,image=%s]",
|
|
music.Type,
|
|
music.Url,
|
|
music.Audio,
|
|
music.Title,
|
|
music.Content,
|
|
music.Image,
|
|
),
|
|
)
|
|
return
|
|
})
|
|
}
|