diff --git a/handler/handler.go b/handler/handler.go index d1706ff..6622645 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -119,7 +119,7 @@ func MsgInHandler(msg model.Message) (reply *model.Reply) { return reply } } - if msg.StructuredMsg[0].GetMessageType() == qq_message.TypeAt { + if len(msg.StructuredMsg) > 0 && msg.StructuredMsg[0].GetMessageType() == qq_message.TypeAt { if atMsg, ok := msg.StructuredMsg[0].(*qq_message.AtMessage); ok { atUserID := atMsg.Data.QQ loginAccountInfo, err := action.GetLoginAccountInfo() diff --git a/service/scoresaber/model.go b/service/scoresaber/model.go index 7e81b75..94e4625 100644 --- a/service/scoresaber/model.go +++ b/service/scoresaber/model.go @@ -203,21 +203,21 @@ type PlayerData struct { } type PlayerDataLite struct { - ID string `json:"id" db:"id"` - Name string `json:"name" db:"name"` - ProfilePicture string `json:"profilePicture" db:"profile_picture"` - Country string `json:"country" db:"country"` - Device string `json:"device" db:"device"` - PP float64 `json:"pp" db:"pp"` - Rank int `json:"rank" db:"rank"` - CountryRank int `json:"countryRank" db:"country_rank"` - TotalScore int `json:"totalScore" db:"total_score"` - TotalRankedScore int `json:"totalRankedScore" db:"total_ranked_score"` - AverageRankedAccuracy float64 `json:"averageRankedAccuracy" db:"average_ranked_accuracy"` - TotalPlayCount int `json:"totalPlayCount" db:"total_play_count"` - RankedPlayCount int `json:"rankedPlayCount" db:"ranked_play_count"` - ReplaysWatched int `json:"replaysWatched" db:"replays_watched"` - GeneratedTime string `json:"generatedTime" db:"generated_time"` + ID string `json:"id" db:"id" gorm:"column:id"` + Name string `json:"name" db:"name" gorm:"column:name"` + ProfilePicture string `json:"profilePicture" db:"profile_picture" gorm:"column:profile_picture"` + Country string `json:"country" db:"country" gorm:"column:country"` + Device string `json:"device" db:"device" gorm:"column:device"` + PP float64 `json:"pp" db:"pp" gorm:"column:pp"` + Rank int `json:"rank" db:"rank" gorm:"column:rank"` + CountryRank int `json:"countryRank" db:"country_rank" gorm:"column:country_rank"` + TotalScore int `json:"totalScore" db:"total_score" gorm:"column:total_score"` + TotalRankedScore int `json:"totalRankedScore" db:"total_ranked_score" gorm:"column:total_ranked_score"` + AverageRankedAccuracy float64 `json:"averageRankedAccuracy" db:"average_ranked_accuracy" gorm:"column:average_ranked_accuracy"` + TotalPlayCount int `json:"totalPlayCount" db:"total_play_count" gorm:"column:total_play_count"` + RankedPlayCount int `json:"rankedPlayCount" db:"ranked_play_count" gorm:"column:ranked_play_count"` + ReplaysWatched int `json:"replaysWatched" db:"replays_watched" gorm:"column:replays_watched"` + GeneratedTime string `json:"generatedTime" db:"generated_time" gorm:"column:generated_time"` } func (p PlayerDataLite) IsDiffFrom(p2 PlayerDataLite) bool {