mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-18 20:50:12 +08:00
优化代码 (#501)
This commit is contained in:
parent
9f37962d22
commit
a55f28c006
@ -259,19 +259,7 @@ func init() {
|
||||
listName := ctx.State["regex_matched"].([]string)[5]
|
||||
ctx.SendChain(message.Text("正在校验歌单信息,请稍等"))
|
||||
// 是否存在该歌单
|
||||
filelist, err := getlist(cfg.MusicPath)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text(serviceErr, "获取歌单列表ERROR:", err))
|
||||
return
|
||||
}
|
||||
ok := true
|
||||
for _, listinfo := range filelist {
|
||||
if listName == listinfo.Name {
|
||||
ok = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if ok {
|
||||
if file.IsNotExist(cfg.MusicPath + listName) {
|
||||
ctx.SendChain(message.Text("歌单不存在,是否创建?(是/否)"))
|
||||
next := zero.NewFutureEvent("message", 999, false, zero.OnlyGroup, zero.RegexRule(`(是|否)`), ctx.CheckSession())
|
||||
recv, cancel := next.Repeat()
|
||||
@ -296,12 +284,13 @@ func init() {
|
||||
break
|
||||
}
|
||||
}
|
||||
err = os.MkdirAll(cfg.MusicPath+listName, 0755)
|
||||
err := os.MkdirAll(cfg.MusicPath+listName, 0755)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text(serviceErr, err))
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.SendChain(message.Text("开始下载歌曲,需要一定时间下载,请稍等"))
|
||||
listID, err := strconv.ParseInt(keyword, 10, 64)
|
||||
if err == nil {
|
||||
err = downloadlist(listID, cfg.MusicPath+listName+"/")
|
||||
|
||||
@ -471,7 +471,7 @@ func init() {
|
||||
fiancee := ctx.State["regex_matched"].([]string)
|
||||
gay, _ := strconv.ParseInt(fiancee[2]+fiancee[3], 10, 64)
|
||||
if gay == uid {
|
||||
ctx.Send(message.ReplyWithMessage(message.At(uid), message.Text("[qqwife]你想给自己买什么礼物呢?")))
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.At(uid), message.Text("[qqwife]你想给自己买什么礼物呢?")))
|
||||
return
|
||||
}
|
||||
// 获取CD
|
||||
@ -504,12 +504,12 @@ func init() {
|
||||
// 计算钱对应的好感值
|
||||
newFavor := 1
|
||||
if favor > 50 {
|
||||
newFavor += moneyToFavor % 10 // 礼物厌倦
|
||||
newFavor = moneyToFavor % 10 // 礼物厌倦
|
||||
} else {
|
||||
newFavor += rand.Intn(moneyToFavor)
|
||||
}
|
||||
// 随机对方心情
|
||||
mood := rand.Intn(5)
|
||||
mood := rand.Intn(2)
|
||||
if mood == 0 {
|
||||
newFavor = -newFavor
|
||||
}
|
||||
|
||||
@ -279,14 +279,14 @@ func init() { // 插件主体
|
||||
"————————————————————\n" +
|
||||
"- 文心对联 [上联]\n" +
|
||||
"————————————————————\n" +
|
||||
"- 文心问答 [问题]" +
|
||||
"- 文心问答 [问题]\n" +
|
||||
"————————————————————\n" +
|
||||
"- 文心补全 [带“_”的填空题]\n" +
|
||||
"————————————————————\n" +
|
||||
"- 文心自定义 [prompt]\n" +
|
||||
"- 文心自定义 [prompt]\n\n" +
|
||||
"prompt: [问题描述] [问题类型]:[题目] [解答类型]:[解题必带内容]\n" +
|
||||
"指令示例:\n" +
|
||||
"文心自定义 请写出下面这道题的解题过程。\\n题目:养殖场养鸭376只,养鸡的只数比鸭多258只,这个养殖场一共养鸭和鸡多少只?\\n解:\n" +
|
||||
"文心自定义 请写出下面这道题的解题过程。\\n题目:养殖场养鸭376只,养鸡的只数比鸭多258只,这个养殖场一共养鸭和鸡多少只?\\n解:\n\n" +
|
||||
"文心自定义 1+1=?\n" +
|
||||
"文心自定义 歌曲名:大风车转啊转\\n歌词:",
|
||||
}).ApplySingle(single.New(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user