Skip to content

Commit

Permalink
优化代码 (FloatTech#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
fangliuyu authored Nov 17, 2022
1 parent 9f37962 commit a55f28c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
17 changes: 3 additions & 14 deletions plugin/guessmusic/apiservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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+"/")
Expand Down
6 changes: 3 additions & 3 deletions plugin/qqwife/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions plugin/wenxinAI/wenxinAI.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a55f28c

Please sign in to comment.