fix chess & kfc && optimize lolicon & bilibili (#817)

* 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>
This commit is contained in:
Jiang-Red 2023-11-12 13:21:37 +08:00 committed by GitHub
parent 73b879a6f4
commit 61168adb2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 8 deletions

View File

@ -46,8 +46,9 @@ func init() {
"- 取消b站直播订阅[uid|name]\n" + "- 取消b站直播订阅[uid|name]\n" +
"- b站推送列表\n" + "- b站推送列表\n" +
"- [开启|关闭]艾特全体\n" + "- [开启|关闭]艾特全体\n" +
"Tips: 需要配合job一起使用, 全局只需要设置一个, 无视响应状态推送, 下为例子\n" + "Tips: 需要先在 bilibili 插件中设置cookie\n" +
"记录在\"@every 5m\"触发的指令)\n" + "需要配合 job 插件一起使用, 全局只需要设置一个, 无视响应状态推送, 下为例子\n" +
"记录在\"@every 5m\"触发的指令\n" +
"拉取b站推送", "拉取b站推送",
PrivateDataFolder: "bilibilipush", PrivateDataFolder: "bilibilipush",
}) })

View File

@ -168,7 +168,7 @@ func resign(groupCode, senderUin int64) (msg message.Message, err error) {
} }
// play 走棋 // 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)} msg = message.Message{message.At(senderUin)}
// 检查对局是否存在 // 检查对局是否存在
room, ok := chessRoomMap.Load(groupCode) room, ok := chessRoomMap.Load(groupCode)
@ -343,7 +343,7 @@ func cleanUserRate(senderUin int64) (msg message.Message, err error) {
} }
// createGame 创建游戏 // 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) room, ok := chessRoomMap.Load(groupCode)
if !ok { if !ok {
chessRoomMap.Store(groupCode, &chessRoom{ chessRoomMap.Store(groupCode, &chessRoom{

View File

@ -2,16 +2,16 @@
package kfccrazythursday package kfccrazythursday
import ( import (
"github.com/FloatTech/floatbox/binary"
"github.com/FloatTech/floatbox/web" "github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl" ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control" "github.com/FloatTech/zbputils/control"
"github.com/tidwall/gjson"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
) )
const ( const (
crazyURL = "https://www.iculture.cc/demo/CrazyThursday/api/kfc.php" crazyURL = "https://api.jixs.cc/api/wenan-fkxqs/index.php"
) )
func init() { func init() {
@ -26,6 +26,6 @@ func init() {
ctx.SendChain(message.Text("ERROR: ", err)) ctx.SendChain(message.Text("ERROR: ", err))
return return
} }
ctx.SendChain(message.Text(gjson.ParseBytes(data).Get("@this.0.content").String())) ctx.SendChain(message.Text(binary.BytesToString(data)))
}) })
} }

View File

@ -115,5 +115,5 @@ func getimgurl(url string) (string, error) {
if imageurl = json.Get("data.0.urls.original").Str; imageurl == "" { if imageurl = json.Get("data.0.urls.original").Str; imageurl == "" {
return "", errors.New("未找到相关内容, 换个tag试试吧") return "", errors.New("未找到相关内容, 换个tag试试吧")
} }
return strings.ReplaceAll(imageurl, "i.pixiv.cat", "i.pixiv.re"), nil return imageurl, nil
} }