modules/roles: Clean up code

master
Luther Wen Xu 2019-12-12 15:30:25 +07:00
parent 07d61be4be
commit ae09dbbe85
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 1 additions and 4 deletions

@ -13,7 +13,7 @@ func GetOldLevel(s *discordgo.Session, id string) (int, error) {
if err != nil { if err != nil {
return 0, fmt.Errorf("roles: EligibleGachaCount: error fetching guild member (%s): %w", id, err) return 0, fmt.Errorf("roles: EligibleGachaCount: error fetching guild member (%s): %w", id, err)
} }
var foundLevel = 0 foundLevel := 0
levelSearchLoop: levelSearchLoop:
for i := len(rolesFromLevel); i > 0; i-- { for i := len(rolesFromLevel); i > 0; i-- {
for _, v := range member.Roles { for _, v := range member.Roles {
@ -23,8 +23,5 @@ levelSearchLoop:
} }
} }
} }
if foundLevel == 0 {
return 0, nil
}
return foundLevel, nil return foundLevel, nil
} }