fix: Prevent people with no role from getting roles

master
Luther Wen Xu 2020-05-30 22:56:19 +07:00
parent d273102aa2
commit 830eeb543a
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 4 additions and 0 deletions

@ -32,6 +32,10 @@ func AssignRoles(dg *discordgo.Session, guildID string, userID string, rank Rank
util.ReportError(dg, err) util.ReportError(dg, err)
return return
} }
//FIXME: Hack. To prevent someone who isn't part of the server yet to be assigned a role.
if len(member.Roles) == 0 {
return
}
OuterLoop: OuterLoop:
for i := 0; i <= int(rank); i++ { for i := 0; i <= int(rank); i++ {
if i >= len(Roles) { if i >= len(Roles) {