From 41958deb0a541b08ec887e293602f343ef52b601 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Tue, 28 Mar 2023 22:47:01 +0500 Subject: [PATCH] Fixed a memory leak caused by hitting rate limits, caused by attempts to add unset starter roles Signed-off-by: Octol1ttle --- Boyfriend.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Boyfriend.cs b/Boyfriend.cs index a10b1c5..3403ddf 100644 --- a/Boyfriend.cs +++ b/Boyfriend.cs @@ -150,13 +150,13 @@ public static class Boyfriend { if (!mData.IsInGuild) continue; if (mData.MutedUntil is null && ulong.TryParse(config["StarterRole"], out var starterRoleId) + && guild.GetRole(starterRoleId) is not null && !mData.Roles.Contains(starterRoleId)) _ = user.AddRoleAsync(starterRoleId); if (now >= mData.MutedUntil) { - await Utils.UnmuteMemberAsync( + saveData = await Utils.UnmuteMemberAsync( data, Client.CurrentUser.ToString(), user, Messages.PunishmentExpired); - saveData = true; } for (var i = mData.Reminders.Count - 1; i >= 0; i--) {