refactor: 移除 ScoreSaber 和 BeatLeader 热门成绩相关代码,并为玩家信息添加头像显示
This commit is contained in:
@@ -24,8 +24,6 @@ func init() {
|
||||
handler.RegisterHelpInform("解绑ss", "scoresaber", "解绑您的scoresaber账号")
|
||||
handler.RegisterHandler("最新ss", getMyRecentScore, constants.LEVEL_USER)
|
||||
handler.RegisterHelpInform("最新ss", "scoresaber", "查看您的最新游戏记录")
|
||||
handler.RegisterHandler("最热ss", getRecentScore, constants.LEVEL_USER)
|
||||
handler.RegisterHelpInform("最热ss", "scoresaber", "查看全大陆的最新游戏记录")
|
||||
handler.RegisterHandler("截ss", screenshotSS, constants.LEVEL_USER)
|
||||
handler.RegisterHelpInform("截ss", "scoresaber", "scoresaber主页截图")
|
||||
handler.RegisterHandler("jss", screenshotSS, constants.LEVEL_USER)
|
||||
@@ -41,7 +39,6 @@ func getSSProfile(msg model.Message) (reply model.Reply) {
|
||||
)
|
||||
var ssId string
|
||||
if len(msg.RawMsg) > len("查ss ") {
|
||||
// ssId = msg.RawMsg[len("查ss "):]
|
||||
ssId = strings.Split(msg.RawMsg, " ")[1]
|
||||
noUpdate = true
|
||||
}
|
||||
@@ -53,7 +50,6 @@ func getSSProfile(msg model.Message) (reply model.Reply) {
|
||||
ssId, err = scoresaber.GetSSID(userIdStr)
|
||||
}
|
||||
if err != nil {
|
||||
// return "您未绑定ss账号,输入\"绑定ss [ssId]\"绑定", nil
|
||||
return model.Reply{
|
||||
ReplyMsg: "您未绑定ss账号,输入\"绑定ss [ssId]\"绑定",
|
||||
ReferOriginMsg: true,
|
||||
@@ -66,7 +62,7 @@ func getSSProfile(msg model.Message) (reply model.Reply) {
|
||||
resultStr, err = scoresaber.SSQuery.GetScoreWithoutUpdate(ssId)
|
||||
}
|
||||
if err == nil {
|
||||
break // 成功时退出循环
|
||||
break
|
||||
}
|
||||
attempts++
|
||||
log.Printf("获取分数时出错,第 %d 次重试: %v", attempts, err)
|
||||
@@ -100,36 +96,6 @@ func unbindSS(msg model.Message) (reply model.Reply) {
|
||||
}
|
||||
}
|
||||
|
||||
func getRecentScore(msg model.Message) (reply model.Reply) {
|
||||
count := 1
|
||||
if len(msg.RawMsg) > len("最热ss ") {
|
||||
var err error
|
||||
count, err = strconv.Atoi(msg.RawMsg[len("最热ss "):])
|
||||
if err != nil || count <= 0 {
|
||||
return model.Reply{
|
||||
ReplyMsg: "",
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
if count > 10 {
|
||||
count = 10
|
||||
}
|
||||
}
|
||||
scoreMsg := ""
|
||||
for _, v := range scoresaber.ScoresManager.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
|
||||
scoreMsg := ""
|
||||
|
||||
Reference in New Issue
Block a user