Skip to content

Commit

Permalink
fix ignored roles
Browse files Browse the repository at this point in the history
  • Loading branch information
loukylor committed Dec 29, 2024
1 parent a14a2d0 commit 2954210
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions TrickFireDiscordBot/Services/RoleSyncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Task<PaginatedList<Page>> nextPageQuery(string? cursor) =>
DiscordRole inactiveRole = _discordRoleCache.Values.First(role => role.Id == options.Value.InactiveRoleId);
await foreach (DiscordMember member in discordService.MainGuild.GetAllMembersAsync())
{
if (processedMembers.Contains(member))
if (processedMembers.Contains(member) || member.Roles.Any(role => options.Value.SafeRoleIds.Contains(role.Id)))
{
continue;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
try
{
await SyncRoles(await _pageQueue.Reader.ReadAsync(stoppingToken), true);
await SyncRoles(await _pageQueue.Reader.ReadAsync(stoppingToken), false);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -142,11 +142,6 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
if (!dryRun)
{
int highestRole = discordService.MainGuild.CurrentMember.Roles.Max(role => role.Position);
if (member.Roles.Any(role => options.Value.SafeRoleIds.Contains(role.Id)))
{
return member;
}

await member.ModifyAsync(model =>
{
List<DiscordRole> rolesWithLeadership = new(newRoles);
Expand Down
2 changes: 1 addition & 1 deletion TrickFireDiscordBot/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"TechnicalLeadRoleId": 1314341103603810384,
"TechnicalLeadRegex": "(.* ((Team Lead)|(Mission Director)))|(System Integrator)",
"InactiveRoleId": 1183543002036174918,
"SafeRoleIds": [ 593164234905354261 ]
"SafeRoleIds": [ 593164234905354261, 593275442408980550 ]
},
"BotStateOptions": {
"FileLocation": "state.json"
Expand Down

0 comments on commit 2954210

Please sign in to comment.