Skip to content

Commit

Permalink
fix role assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
loukylor committed Dec 19, 2024
1 parent 1dd90c0 commit 2187b3e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions TrickFireDiscordBot/RoleSyncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,10 @@ private void OnWebhook(HttpListenerRequest request)
return null;
}

IEnumerable<DiscordRole?> newRoles = await GetRoles(notionPage);
IEnumerable<DiscordRole> newRoles = await GetRoles(notionPage);
Logger.LogInformation(member.DisplayName);
foreach (DiscordRole? role in newRoles)
foreach (DiscordRole role in newRoles)
{
if (role is null)
{
continue;
}

Logger.LogInformation(role!.Name);
}

Expand All @@ -133,7 +128,7 @@ private void OnWebhook(HttpListenerRequest request)
int highestRole = botMember.Roles.Max(role => role.Position);
await member.ModifyAsync(model =>
{
List<DiscordRole> rolesWithLeadership = [];
List<DiscordRole> rolesWithLeadership = new(newRoles);
foreach (DiscordRole role in member.Roles.Where(role => role.Position >= highestRole))
{
rolesWithLeadership.Add(role);
Expand Down

0 comments on commit 2187b3e

Please sign in to comment.