From 61168adb2e4e1ddb5ae1b2952db8755760065db0 Mon Sep 17 00:00:00 2001 From: Jiang-Red <79574799+Jiang-Red@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:21:37 +0800 Subject: [PATCH] fix chess & kfc && optimize lolicon & bilibili (#817) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix chess & kfc && optimize bilibili & lolicon * chore(lint): 改进代码样式 (#27) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- plugin/bilibili/bilibilipush.go | 5 +++-- plugin/chess/core.go | 4 ++-- plugin/kfccrazythursday/kfccrazythursday.go | 6 +++--- plugin/lolicon/lolicon.go | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/plugin/bilibili/bilibilipush.go b/plugin/bilibili/bilibilipush.go index e95aec1fa6..f114d78ee2 100644 --- a/plugin/bilibili/bilibilipush.go +++ b/plugin/bilibili/bilibilipush.go @@ -46,8 +46,9 @@ func init() { "- 取消b站直播订阅[uid|name]\n" + "- b站推送列表\n" + "- [开启|关闭]艾特全体\n" + - "Tips: 需要配合job一起使用, 全局只需要设置一个, 无视响应状态推送, 下为例子\n" + - "记录在\"@every 5m\"触发的指令)\n" + + "Tips: 需要先在 bilibili 插件中设置cookie\n" + + "需要配合 job 插件一起使用, 全局只需要设置一个, 无视响应状态推送, 下为例子\n" + + "记录在\"@every 5m\"触发的指令\n" + "拉取b站推送", PrivateDataFolder: "bilibilipush", }) diff --git a/plugin/chess/core.go b/plugin/chess/core.go index aecbf0d0d3..d3e0926b04 100644 --- a/plugin/chess/core.go +++ b/plugin/chess/core.go @@ -168,7 +168,7 @@ func resign(groupCode, senderUin int64) (msg message.Message, err error) { } // play 走棋 -func play(senderUin int64, groupCode int64, moveStr string) (msg message.Message, err error) { +func play(groupCode, senderUin int64, moveStr string) (msg message.Message, err error) { msg = message.Message{message.At(senderUin)} // 检查对局是否存在 room, ok := chessRoomMap.Load(groupCode) @@ -343,7 +343,7 @@ func cleanUserRate(senderUin int64) (msg message.Message, err error) { } // createGame 创建游戏 -func createGame(isBlindfold bool, groupCode int64, senderUin int64, senderName string) (msg message.Message, err error) { +func createGame(isBlindfold bool, groupCode, senderUin int64, senderName string) (msg message.Message, err error) { room, ok := chessRoomMap.Load(groupCode) if !ok { chessRoomMap.Store(groupCode, &chessRoom{ diff --git a/plugin/kfccrazythursday/kfccrazythursday.go b/plugin/kfccrazythursday/kfccrazythursday.go index 22faee506c..971dd1e452 100644 --- a/plugin/kfccrazythursday/kfccrazythursday.go +++ b/plugin/kfccrazythursday/kfccrazythursday.go @@ -2,16 +2,16 @@ package kfccrazythursday import ( + "github.com/FloatTech/floatbox/binary" "github.com/FloatTech/floatbox/web" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" - "github.com/tidwall/gjson" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" ) const ( - crazyURL = "https://www.iculture.cc/demo/CrazyThursday/api/kfc.php" + crazyURL = "https://api.jixs.cc/api/wenan-fkxqs/index.php" ) func init() { @@ -26,6 +26,6 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - ctx.SendChain(message.Text(gjson.ParseBytes(data).Get("@this.0.content").String())) + ctx.SendChain(message.Text(binary.BytesToString(data))) }) } diff --git a/plugin/lolicon/lolicon.go b/plugin/lolicon/lolicon.go index 516a4ca3b9..25f5eb3465 100644 --- a/plugin/lolicon/lolicon.go +++ b/plugin/lolicon/lolicon.go @@ -115,5 +115,5 @@ func getimgurl(url string) (string, error) { if imageurl = json.Get("data.0.urls.original").Str; imageurl == "" { return "", errors.New("未找到相关内容, 换个tag试试吧") } - return strings.ReplaceAll(imageurl, "i.pixiv.cat", "i.pixiv.re"), nil + return imageurl, nil }