From 830eeb543a31be340c077246b3e628770848a160 Mon Sep 17 00:00:00 2001 From: Luther Wen Xu Date: Sat, 30 May 2020 22:56:19 +0800 Subject: [PATCH] fix: Prevent people with no role from getting roles --- level/roles.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/level/roles.go b/level/roles.go index 6024a70..fe0177a 100644 --- a/level/roles.go +++ b/level/roles.go @@ -32,6 +32,10 @@ func AssignRoles(dg *discordgo.Session, guildID string, userID string, rank Rank util.ReportError(dg, err) 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: for i := 0; i <= int(rank); i++ { if i >= len(Roles) {