From 893c4ae8876c77acccf1883987ffc52d3aedafb7 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Thu, 10 Apr 2025 10:45:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20blPlus=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E7=94=A8=E6=88=B7=E5=88=86=E6=95=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=92=8C=E6=8E=92=E5=90=8D=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/beatleader/beatleader.go | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/handler/beatleader/beatleader.go b/handler/beatleader/beatleader.go index a0c1726..675596a 100644 --- a/handler/beatleader/beatleader.go +++ b/handler/beatleader/beatleader.go @@ -30,6 +30,67 @@ func init() { handler.RegisterHandler("jbl", screenShotBL, constants.LEVEL_USER) } +// func blPlus(msg model.Message) (reply model.Reply) { +// var ( +// resultStr strings.Builder +// err error +// maxRetries = 5 // 最大重试次数 +// attempts = 0 +// ) +// var N int +// if len(msg.RawMsg) > len("bl+") { +// N, err = strconv.Atoi(msg.RawMsg[len("bl+"):]) +// if err != nil || N <= 0 { +// return model.Reply{ +// ReplyMsg: "请输入一个正整数", +// ReferOriginMsg: true, +// FromMsg: msg, +// } +// } +// } +// userIdStr := strconv.Itoa(int(msg.UserId)) +// userBLID, err := scoresaber.GetSSID(userIdStr) +// if err != nil { +// return model.Reply{ +// ReplyMsg: err.Error(), +// ReferOriginMsg: true, +// FromMsg: msg, +// } +// } +// var userInfo beatleader.PlayerData +// for attempts < maxRetries { +// err = nil +// userInfo, err = beatleader.FetchPlayerData(userBLID) +// if err != nil { +// break +// } +// attempts++ +// } +// if err != nil { +// return model.Reply{ +// ReplyMsg: "获取您的分数时出现问题,请稍后重试。" + err.Error(), +// ReferOriginMsg: true, +// FromMsg: msg, +// } +// } +// resultStr.WriteString(fmt.Sprintf("您当前的全区排名为:%d\n", userInfo.CountryRank)) +// // 获取当前用户所在区对应+N位的玩家列表 +// leaderboard, err := beatleader.FetchCountryLeaderboard(userInfo.Country, userInfo.CountryRank-N, userInfo.ID) +// if err != nil { +// return model.Reply{ +// ReplyMsg: "获取当前用户所在区对应+N位的玩家列表时出现问题,请稍后重试。" + err.Error(), +// ReferOriginMsg: true, +// FromMsg: msg, +// } +// } +// resultStr.WriteString(fmt.Sprintf("您只需要再打出%.2fpp就能达到%s区第%d名。", targetPlayer.PP-userInfo.PP, userInfo.Country, targetPlayer.CountryRank)) +// return model.Reply{ +// ReplyMsg: resultStr.String(), +// ReferOriginMsg: true, +// FromMsg: msg, +// } +// } + func getMyBL(msg model.Message) (reply *model.Reply) { var ( resultStr string