Fixed a memory leak caused by hitting rate limits, caused by attempts to add unset starter roles

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-03-28 22:47:01 +05:00
parent 05ce680373
commit 41958deb0a
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF

View file

@ -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--) {