refactor: 调整 BeatLeader 模块,注释并移除热门成绩相关功能

This commit is contained in:
lixiangwuxian
2025-03-08 19:22:41 +08:00
parent 33a59e6118
commit bfac7dfa59
4 changed files with 124 additions and 119 deletions

View File

@@ -23,8 +23,8 @@ func init() {
handler.RegisterHelpInform("解绑bl", "beatleader", "解绑bl 解绑您的beatleader账号")
handler.RegisterHandler("最新bl", getMyRecentScore, constants.LEVEL_USER)
handler.RegisterHelpInform("最新bl", "beatleader", "最新bl 查看您的最新游戏记录")
handler.RegisterHandler("最热bl", getRecentScore, constants.LEVEL_USER)
handler.RegisterHelpInform("最热bl", "beatleader", "最热bl 查看全大陆的最新游戏记录")
// handler.RegisterHandler("最热bl", getRecentScore, constants.LEVEL_USER)
// handler.RegisterHelpInform("最热bl", "beatleader", "最热bl 查看全大陆的最新游戏记录")
handler.RegisterHandler("截bl", screenShotBL, constants.LEVEL_USER)
handler.RegisterHelpInform("截bl", "beatleader", "截bl 截bl 截bl主页截图")
handler.RegisterHandler("jbl", screenShotBL, constants.LEVEL_USER)
@@ -82,35 +82,35 @@ func unbindBL(msg model.Message) (reply model.Reply) {
}
}
func getRecentScore(msg model.Message) (reply model.Reply) {
count := 1
if len(msg.RawMsg) > len("最热bl ") {
var err error
count, err = strconv.Atoi(msg.RawMsg[len("最热bl "):])
if err != nil || count <= 0 {
return model.Reply{
ReplyMsg: "",
ReferOriginMsg: true,
FromMsg: msg,
}
}
if count > 10 {
count = 10
}
}
scoreMsg := ""
for _, v := range beatleader.BlScoresManager.GetRecentScores(count, " WHERE country = 'CN' ") {
scoreMsg += v.ToString() + "\n\n"
}
if len(scoreMsg) > 0 {
scoreMsg = scoreMsg[:len(scoreMsg)-len("\n\n")]
}
return model.Reply{
ReplyMsg: scoreMsg,
ReferOriginMsg: true,
FromMsg: msg,
}
}
// func getRecentScore(msg model.Message) (reply model.Reply) {
// count := 1
// if len(msg.RawMsg) > len("最热bl ") {
// var err error
// count, err = strconv.Atoi(msg.RawMsg[len("最热bl "):])
// if err != nil || count <= 0 {
// return model.Reply{
// ReplyMsg: "",
// ReferOriginMsg: true,
// FromMsg: msg,
// }
// }
// if count > 10 {
// count = 10
// }
// }
// scoreMsg := ""
// for _, v := range beatleader.BlScoresManager.GetRecentScores(count, " WHERE country = 'CN' ") {
// scoreMsg += v.ToString() + "\n\n"
// }
// if len(scoreMsg) > 0 {
// scoreMsg = scoreMsg[:len(scoreMsg)-len("\n\n")]
// }
// return model.Reply{
// ReplyMsg: scoreMsg,
// ReferOriginMsg: true,
// FromMsg: msg,
// }
// }
func getMyRecentScore(msg model.Message) (reply model.Reply) {
count := 1