From 906bfd07e8ee798526d7ea590500f46b4cacd2d8 Mon Sep 17 00:00:00 2001 From: Macintosh II <95250141+mctaylors@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:27:28 +0300 Subject: [PATCH] Skip refreshing roles if the member is role-muted (#118) Closes #116 --- src/Services/GuildDataService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Services/GuildDataService.cs b/src/Services/GuildDataService.cs index b07755d..0833adf 100644 --- a/src/Services/GuildDataService.cs +++ b/src/Services/GuildDataService.cs @@ -110,10 +110,13 @@ public sealed class GuildDataService : IHostedService continue; } - var memberResult = await _guildApi.GetGuildMemberAsync(guildId, data.Id.ToSnowflake(), ct); - if (memberResult.IsSuccess) + if (data.MutedUntil is null) { - data.Roles = memberResult.Entity.Roles.ToList().ConvertAll(r => r.Value); + var memberResult = await _guildApi.GetGuildMemberAsync(guildId, data.Id.ToSnowflake(), ct); + if (memberResult.IsSuccess) + { + data.Roles = memberResult.Entity.Roles.ToList().ConvertAll(r => r.Value); + } } memberData.Add(data.Id, data);