refactor: 在 getMyBLPic 函数中优化用户ID获取逻辑,支持从消息中提取用户ID,提升代码灵活性
This commit is contained in:
parent
2ada30d859
commit
f20edf3e78
@ -173,7 +173,13 @@ func getMyBLPic(msg model.Message) (reply *model.Reply) {
|
|||||||
attempts = 0
|
attempts = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
userIdStr := strconv.Itoa(int(msg.UserId))
|
tokens := util.SplitN(msg.RawMsg, 2)
|
||||||
|
var userIdStr string
|
||||||
|
if len(tokens) == 2 {
|
||||||
|
userIdStr = tokens[1]
|
||||||
|
} else {
|
||||||
|
userIdStr = strconv.Itoa(int(msg.UserId))
|
||||||
|
}
|
||||||
var data *beatleader.PlayerDataLite
|
var data *beatleader.PlayerDataLite
|
||||||
var lastData *beatleader.PlayerDataLite
|
var lastData *beatleader.PlayerDataLite
|
||||||
for attempts < maxRetries {
|
for attempts < maxRetries {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user