fix: 添加 blPlus 函数的初步实现,包含用户分数获取和排名计算逻辑
This commit is contained in:
parent
eafc291a93
commit
893c4ae887
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user