|
|
|
@ -39,17 +39,17 @@ func ScheduleUpdates(s *discordgo.Session) {
|
|
|
|
|
}
|
|
|
|
|
if lastKnownLevel[id] != level {
|
|
|
|
|
lastKnownLevel[id] = level
|
|
|
|
|
go func() {
|
|
|
|
|
oldLevel, err := roles.GetOldLevel(s, id)
|
|
|
|
|
go func(checkID string, newLevel int) {
|
|
|
|
|
oldLevel, err := roles.GetOldLevel(s, checkID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error(s, err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if level > oldLevel {
|
|
|
|
|
gacha.RollReward(s, id, level-oldLevel)
|
|
|
|
|
roles.GiveLevelRoles(s, id, oldLevel, level)
|
|
|
|
|
if newLevel > oldLevel {
|
|
|
|
|
gacha.RollReward(s, checkID, newLevel-oldLevel)
|
|
|
|
|
roles.GiveLevelRoles(s, checkID, oldLevel, newLevel)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
}(id, level)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
levelMutex.Unlock()
|
|
|
|
|