package roles import ( "github.com/bwmarrin/discordgo" "PermissionGacha/modules/config" "PermissionGacha/modules/log" ) func GiveLevelRoles(s *discordgo.Session, discordID string, oldLevel, newLevel int) { for i := oldLevel + 1; i <= newLevel; i++ { s.GuildMemberRoleAdd(config.GuildID, discordID, rolesFromLevel[i-1]) } } func RemoveAllLevelRoles(s *discordgo.Session, discordID string) { member, err := s.GuildMember(config.GuildID, discordID) if err != nil { log.Error(s, "RemoveAllLevelRoles", "GuildMember", discordID) return } for _, v := range member.Roles { for _, w := range rolesFromLevel { if v == w { s.GuildMemberRoleRemove(config.GuildID, discordID, v) break } } } }