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