diff --git a/Commands/Debug.cs b/Commands/Debug.cs index b65e9a0b..ee462d29 100644 --- a/Commands/Debug.cs +++ b/Commands/Debug.cs @@ -3,7 +3,7 @@ internal class Debug : BaseCommandModule { public static Dictionary OverridesPendingAddition = new(); - + [Group("debug")] [Aliases("troubleshoot", "unbug", "bugn't", "helpsomethinghasgoneverywrong")] [Description("Commands and things for fixing the bot in the unlikely event that it breaks a bit.")] @@ -222,7 +222,7 @@ public async Task CheckPendingChannelEvents(CommandContext ctx) { var pendingUpdateEvents = Tasks.EventTasks.PendingChannelUpdateEvents; var pendingDeleteEvents = Tasks.EventTasks.PendingChannelDeleteEvents; - + if (pendingUpdateEvents.Count == 0 && pendingDeleteEvents.Count == 0) { await ctx.RespondAsync("There are no pending channel events left to handle!"); @@ -249,7 +249,7 @@ public async Task CheckPendingChannelEvents(CommandContext ctx) } list += "```\n"; } - + await ctx.RespondAsync(await StringHelpers.CodeOrHasteBinAsync(list)); } @@ -313,7 +313,7 @@ public async Task Import(CommandContext ctx, { // Import overrides var (success, failedOverwrite) = await ImportOverridesFromChannelAsync(channel); - + if (success) await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Overrides for {channel.Mention} imported successfully!"); else @@ -327,7 +327,7 @@ await ctx.RespondAsync( public async Task ImportAll(CommandContext ctx) { var msg = await ctx.RespondAsync($"{Program.cfgjson.Emoji.Loading} Working..."); - + // Get all channels var channels = await ctx.Guild.GetChannelsAsync(); @@ -340,7 +340,7 @@ public async Task ImportAll(CommandContext ctx) if (!success) anyImportFailed = true; } - + if (anyImportFailed) await msg.ModifyAsync($"{Program.cfgjson.Emoji.Error} Some overrides failed to import. Most likely this means I found overrides in the database but couldn't parse them. Check the database manually for details."); else @@ -362,13 +362,13 @@ public async Task Add(CommandContext ctx, var confirmButton = new DiscordButtonComponent(DiscordButtonStyle.Success, "debug-overrides-add-confirm-callback", "Yes"); var cancelButton = new DiscordButtonComponent(DiscordButtonStyle.Danger, "debug-overrides-add-cancel-callback", "No"); - + var confirmationMessage = await ctx.RespondAsync(new DiscordMessageBuilder().WithContent( $"{Program.cfgjson.Emoji.ShieldHelp} Just to confirm, you want to add the following override for {user.Mention} to {channel.Mention}?\n" + $"**Allowed:** {parsedAllowedPerms}\n" + $"**Denied:** {parsedDeniedPerms}\n") .AddComponents([confirmButton, cancelButton])); - + OverridesPendingAddition.Add(confirmationMessage.Id, new PendingUserOverride { ChannelId = channel.Id, @@ -419,7 +419,7 @@ public async Task Apply(CommandContext ctx, [Description("The user whose overrides to apply.")] DiscordUser user) { var msg = await ctx.RespondAsync($"{Program.cfgjson.Emoji.Loading} Working on it..."); - + // Try fetching member to determine whether they are in the server. If they are not, we can't apply overrides for them. DiscordMember member; try @@ -431,7 +431,7 @@ public async Task Apply(CommandContext ctx, await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That user isn't in the server! I can't apply overrides for them."); return; } - + var userOverwrites = await Program.db.HashGetAsync("overrides", member.Id.ToString()); if (string.IsNullOrWhiteSpace(userOverwrites)) { @@ -469,13 +469,13 @@ public async Task Apply(CommandContext ctx, await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I don't have permission to add overrides in {channel.Mention}! Continuing..."); numAppliedOverrides--; } - + } await msg.ModifyAsync(x => x.Content = $"{Program.cfgjson.Emoji.Success} Successfully applied {numAppliedOverrides}/{dictionary.Count} overrides for {user.Mention}!"); } } - + [Command("dumpchanneloverrides")] [Description("Dump all of a channel's overrides. This pulls from Discord, not the database.")] [IsBotOwner] @@ -489,7 +489,7 @@ public async Task DumpChannelOverrides(CommandContext ctx, { output += $"{JsonConvert.SerializeObject(overwrite)}\n"; } - + await ctx.RespondAsync(await StringHelpers.CodeOrHasteBinAsync(output, "json")); } @@ -542,7 +542,7 @@ public async Task DumpRawMessage(CommandContext ctx, [Description("The message w if (Constants.RegexConstants.discord_link_rx.IsMatch(msgLinkOrId)) { // Assume the user provided a message link. Extract channel and message IDs to get message content. - + // Pattern to extract channel and message IDs from URL var idPattern = new Regex(@"(?:.*\/)([0-9]+)\/([0-9]+)$"); @@ -560,7 +560,7 @@ public async Task DumpRawMessage(CommandContext ctx, [Description("The message w await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I couldn't fetch the channel from your message link! Please try again."); return; } - + // Get message ID var targetMessage = Convert.ToUInt64(idPattern.Match(msgLinkOrId).Groups[2].ToString().Replace("/", "")); @@ -613,7 +613,7 @@ public async Task DumpRawMessage(CommandContext ctx, [Description("The message w { // Imports overrides from the specified channel to the database. See 'debug overrides import' and 'debug overrides importall' // Return (true, 0) on success, (false, ) on failure - + // Import all overrides for channel to db foreach (var overwrite in channel.PermissionOverwrites) { diff --git a/Commands/InteractionCommands/DebugInteractions.cs b/Commands/InteractionCommands/DebugInteractions.cs index 45e27ca8..64cd5669 100644 --- a/Commands/InteractionCommands/DebugInteractions.cs +++ b/Commands/InteractionCommands/DebugInteractions.cs @@ -25,7 +25,7 @@ public async Task ScamCheck(InteractionContext ctx, [Option("input", "Domain or } responseToSend += await StringHelpers.CodeOrHasteBinAsync(responseText, "json"); - + await ctx.RespondAsync(responseToSend); } else diff --git a/Commands/InteractionCommands/MuteInteractions.cs b/Commands/InteractionCommands/MuteInteractions.cs index 46d1339d..60e132ba 100644 --- a/Commands/InteractionCommands/MuteInteractions.cs +++ b/Commands/InteractionCommands/MuteInteractions.cs @@ -126,7 +126,7 @@ public async Task TqsMuteSlashCommand( { // blah } - + if (await Program.db.HashExistsAsync("mutes", targetUser.Id) || (targetMember is not null && (targetMember.Roles.Contains(mutedRole) || targetMember.Roles.Contains(tqsMutedRole)))) { await ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent($"{Program.cfgjson.Emoji.Error} {ctx.User.Mention}, that user is already muted.")); diff --git a/Commands/InteractionCommands/WarningInteractions.cs b/Commands/InteractionCommands/WarningInteractions.cs index 92c6fb77..f8ef59d3 100644 --- a/Commands/InteractionCommands/WarningInteractions.cs +++ b/Commands/InteractionCommands/WarningInteractions.cs @@ -87,7 +87,7 @@ public async Task TransferWarningsSlashCommand(InteractionContext ctx, await ctx.FollowUpAsync(new DiscordFollowupMessageBuilder().WithContent($"{Program.cfgjson.Emoji.Error} The source and target users cannot be the same!")); return; } - + var sourceWarnings = await Program.db.HashGetAllAsync(sourceUser.Id.ToString()); var targetWarnings = await Program.db.HashGetAllAsync(targetUser.Id.ToString()); diff --git a/Commands/Mutes.cs b/Commands/Mutes.cs index 860dd21f..9bd52aef 100644 --- a/Commands/Mutes.cs +++ b/Commands/Mutes.cs @@ -128,7 +128,7 @@ public async Task TqsMuteCmd( { // blah } - + if (await Program.db.HashExistsAsync("mutes", targetUser.Id) || (targetMember != default && (targetMember.Roles.Contains(mutedRole) || targetMember.Roles.Contains(tqsMutedRole)))) { await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} {ctx.User.Mention}, that user is already muted."); diff --git a/Commands/Warnings.cs b/Commands/Warnings.cs index c334d5e8..3f2fd59e 100644 --- a/Commands/Warnings.cs +++ b/Commands/Warnings.cs @@ -190,7 +190,7 @@ public async Task WarnDetailsCmd( await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I couldn't find a warning for that user with that ID! Please check again."); else if (warning.Type == WarningType.Note) { - await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That's a note, not a warning! Try using `/note details` instead, or make sure you've got the right warning ID."); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That's a note, not a warning! Try using `/note details` instead, or make sure you've got the right warning ID."); } else await ctx.RespondAsync(null, await FancyWarnEmbedAsync(warning, true, userID: targetUser.Id)); @@ -299,7 +299,7 @@ public async Task MostWarningsDayCmd(CommandContext ctx) foreach (var warning in warningsOutput) { if (warning.Value.Type != WarningType.Warning) continue; - + var day = warning.Value.WarnTimestamp.ToString("yyyy-MM-dd"); if (!counts.ContainsKey(day)) { diff --git a/Events/ChannelEvents.cs b/Events/ChannelEvents.cs index beaa054a..8d44533d 100644 --- a/Events/ChannelEvents.cs +++ b/Events/ChannelEvents.cs @@ -2,7 +2,7 @@ { public class ChannelEvents { -public static async Task ChannelUpdated(DiscordClient _, ChannelUpdatedEventArgs e) + public static async Task ChannelUpdated(DiscordClient _, ChannelUpdatedEventArgs e) { // Add this event to the pending events list. These are handled in a task later, see Tasks/EventTasks/HandlePendingChannelUpdateEventsAsync // using DateTime might seem weird, but it's something that is unique for each event diff --git a/Events/InteractionEvents.cs b/Events/InteractionEvents.cs index 760166a4..db8dd097 100644 --- a/Events/InteractionEvents.cs +++ b/Events/InteractionEvents.cs @@ -69,25 +69,25 @@ await LogChannelHelper.LogDeletedMessagesAsync( else if (e.Id == "debug-overrides-add-confirm-callback") { await e.Interaction.CreateResponseAsync(DiscordInteractionResponseType.DeferredMessageUpdate); - + var overridesPendingAddition = Commands.Debug.OverridesPendingAddition; if (!overridesPendingAddition.ContainsKey(e.Message.Id)) { await e.Channel.SendMessageAsync(new DiscordMessageBuilder().WithContent($"{cfgjson.Emoji.Error} {e.User.Mention}, this action has already been completed!").WithReply(e.Message.Id)); - + // Remove buttons from original message so this doesn't happen again var originalMsgWithoutButtons = new DiscordMessageBuilder(e.Message); originalMsgWithoutButtons.ClearComponents(); await e.Message.ModifyAsync(originalMsgWithoutButtons); - + return; } - + // Get override data var pendingOverride = overridesPendingAddition.GetValueOrDefault(e.Message.Id); var mockOverwrite = pendingOverride.Overwrite; var channelId = pendingOverride.ChannelId; - + // This is really cursed, but it effectively converts our mock DiscordOverwrite into an actual one so that it can be added to the current list of overwrites. // Since the mock overwrite serializes into the same format as a DiscordOverwrite, we can serialize it and then deserialize it back to DiscordOverwrite to convert it. var newOverwrite = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(mockOverwrite)); @@ -97,14 +97,14 @@ await LogChannelHelper.LogDeletedMessagesAsync( if (userOverwrites.IsNullOrEmpty) { // No overwrites for this user yet, create a list and add to it - + var overwrites = new Dictionary { { channelId.ToString(), newOverwrite } }; await db.HashSetAsync("overrides", mockOverwrite.Id, JsonConvert.SerializeObject(overwrites)); } else { // Overwrites for user exist, add to them - + var overwrites = JsonConvert.DeserializeObject>(userOverwrites); if (overwrites.ContainsKey(channelId.ToString())) { @@ -112,18 +112,18 @@ await LogChannelHelper.LogDeletedMessagesAsync( var mergeConfirmResponse = new DiscordMessageBuilder() .WithContent($"{cfgjson.Emoji.Warning} **Caution:** This user already has an override for <#{channelId}>! Do you want to merge the permissions? Here are their **current** permissions:\n**Allowed:** {overwrites[channelId.ToString()].Allowed}\n**Denied:** {overwrites[channelId.ToString()].Denied}") .AddComponents(new DiscordButtonComponent(DiscordButtonStyle.Danger, "debug-overrides-add-merge-confirm-callback", "Merge"), new DiscordButtonComponent(DiscordButtonStyle.Primary, "debug-overrides-add-cancel-callback", "Cancel")); - + await e.Message.ModifyAsync(mergeConfirmResponse); return; } else { - overwrites.Add(channelId.ToString(), newOverwrite); + overwrites.Add(channelId.ToString(), newOverwrite); } // Update db await db.HashSetAsync("overrides", mockOverwrite.Id, JsonConvert.SerializeObject(overwrites)); } - + // Remove from db so the override is not added again overridesPendingAddition.Remove(e.Message.Id); @@ -133,20 +133,20 @@ await LogChannelHelper.LogDeletedMessagesAsync( else if (e.Id == "debug-overrides-add-cancel-callback") { await e.Interaction.CreateResponseAsync(DiscordInteractionResponseType.DeferredMessageUpdate); - + var overridesPendingAddition = Commands.Debug.OverridesPendingAddition; if (!overridesPendingAddition.ContainsKey(e.Message.Id)) { await e.Channel.SendMessageAsync(new DiscordMessageBuilder().WithContent($"{cfgjson.Emoji.Error} {e.User.Mention}, this action has already been completed!").WithReply(e.Message.Id)); - + // Remove buttons from original message so this doesn't happen again var originalMsgWithoutButtons = new DiscordMessageBuilder(e.Message); originalMsgWithoutButtons.ClearComponents(); await e.Message.ModifyAsync(originalMsgWithoutButtons); - + return; } - + await e.Message.ModifyAsync(new DiscordMessageBuilder().WithContent($"{Program.cfgjson.Emoji.Error} Cancelled! Nothing was changed.")); overridesPendingAddition.Remove(e.Message.Id); } @@ -154,19 +154,19 @@ await LogChannelHelper.LogDeletedMessagesAsync( { // User already has an overwrite for the requested channel! // Merge the permissions of the current & new overrides. - + await e.Interaction.CreateResponseAsync(DiscordInteractionResponseType.DeferredMessageUpdate); - + var overridesPendingAddition = Commands.Debug.OverridesPendingAddition; if (!overridesPendingAddition.ContainsKey(e.Message.Id)) { await e.Channel.SendMessageAsync(new DiscordMessageBuilder().WithContent($"{cfgjson.Emoji.Error} {e.User.Mention}, this action has already been completed!").WithReply(e.Message.Id)); - + // Remove buttons from original message so this doesn't happen again var originalMsgWithoutButtons = new DiscordMessageBuilder(e.Message); originalMsgWithoutButtons.ClearComponents(); await e.Message.ModifyAsync(originalMsgWithoutButtons); - + return; } @@ -175,11 +175,11 @@ await LogChannelHelper.LogDeletedMessagesAsync( var mockOverwrite = pendingOverride.Overwrite; var channelId = pendingOverride.ChannelId; var newOverwrite = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(mockOverwrite)); - + // Existing override data var userOverwrites = await db.HashGetAsync("overrides", mockOverwrite.Id); var overwrites = JsonConvert.DeserializeObject>(userOverwrites); - + // Merge permissions var existingOverwrite = overwrites[channelId.ToString()]; var newMockOverwrite = new MockUserOverwrite @@ -188,15 +188,15 @@ await LogChannelHelper.LogDeletedMessagesAsync( Allowed = newOverwrite.Allowed | existingOverwrite.Allowed, Denied = newOverwrite.Denied | existingOverwrite.Denied }; - + // Cursed conversion again newOverwrite = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(newMockOverwrite)); - + overwrites[channelId.ToString()] = newOverwrite; - + // Update db await db.HashSetAsync("overrides", mockOverwrite.Id, JsonConvert.SerializeObject(overwrites)); - + // Respond await e.Message.ModifyAsync(new DiscordMessageBuilder().WithContent($"{cfgjson.Emoji.Success} Override successfully added. <@{newOverwrite.Id}> already had an override in <#{pendingOverride.ChannelId}>, so here are their new permissions:\n**Allowed:** {newOverwrite.Allowed}\n**Denied:** {newOverwrite.Denied}")); } diff --git a/Events/MemberEvents.cs b/Events/MemberEvents.cs index fb1e0ea5..19618b64 100644 --- a/Events/MemberEvents.cs +++ b/Events/MemberEvents.cs @@ -6,7 +6,7 @@ public class MemberEvents { public static async Task GuildMemberAdded(DiscordClient client, GuildMemberAddedEventArgs e) { - client.Logger.LogDebug("Got a member added event for {member}", e.Member.Id); + client.Logger.LogDebug("Got a member added event for {member}", e.Member.Id); if (e.Guild.Id != cfgjson.ServerID) return; diff --git a/Events/MessageEvent.cs b/Events/MessageEvent.cs index 2deff620..8e1830c3 100644 --- a/Events/MessageEvent.cs +++ b/Events/MessageEvent.cs @@ -20,10 +20,12 @@ public static async Task MessageCreated(DiscordClient client, MessageCreatedEven { client.Logger.LogError("Got a message create event but the message was null!"); return; - } else if (e.Message.Author is null) + } + else if (e.Message.Author is null) { client.Logger.LogDebug("Got a message create event for a message with no author: {message}", DiscordHelpers.MessageLink(e.Message)); - } else + } + else { client.Logger.LogDebug("Got a message create event for {message} by {user}", DiscordHelpers.MessageLink(e.Message), e.Message.Author.Id); } @@ -37,10 +39,12 @@ public static async Task MessageUpdated(DiscordClient client, MessageUpdatedEven { client.Logger.LogError("Got a message update event but the message was null!"); return; - } else if (e.Message.Author is null) + } + else if (e.Message.Author is null) { client.Logger.LogDebug("Got a message update event for a message with no author: {message}", DiscordHelpers.MessageLink(e.Message)); - } else + } + else { client.Logger.LogDebug("Got a message update event for {message} by {user}", DiscordHelpers.MessageLink(e.Message), e.Message.Author.Id); } @@ -54,10 +58,12 @@ public static async Task MessageDeleted(DiscordClient client, MessageDeletedEven { client.Logger.LogError("Got a message delete event but the message was null!"); return; - } else if (e.Message.Author is null) + } + else if (e.Message.Author is null) { client.Logger.LogDebug("Got a message delete event for a message with no author: {message}", DiscordHelpers.MessageLink(e.Message)); - } else + } + else { client.Logger.LogDebug("Got a message delete event for {message} by {user}", DiscordHelpers.MessageLink(e.Message), e.Message.Author.Id); } diff --git a/Events/ReadyEvent.cs b/Events/ReadyEvent.cs index c7b0b00d..1e98358b 100644 --- a/Events/ReadyEvent.cs +++ b/Events/ReadyEvent.cs @@ -1,5 +1,4 @@ -using System.Runtime.ExceptionServices; -using static Cliptok.Program; +using static Cliptok.Program; namespace Cliptok.Events { @@ -14,7 +13,8 @@ public static async Task OnReady(DiscordClient client, SessionCreatedEventArgs _ { if (!LogChannelHelper.ready) await LogChannelHelper.UnpackLogConfigAsync(cfgjson); - } catch (Exception e) + } + catch (Exception e) { client.Logger.LogCritical(e, "Fatal error unpacking log config!"); Environment.Exit(1); diff --git a/Helpers/BanHelpers.cs b/Helpers/BanHelpers.cs index e110029a..4be5f96a 100644 --- a/Helpers/BanHelpers.cs +++ b/Helpers/BanHelpers.cs @@ -76,7 +76,7 @@ public static async Task BanFromServerAsync(ulong targetUserId, string rea logOut += $"\nChannel: {channel.Mention}"; _ = FindModmailThreadAndSendMessage(guild, $"User ID: {targetUserId}", logOut); - + // Remove user message tracking if (await Program.db.SetContainsAsync("trackedUsers", targetUserId)) { @@ -156,7 +156,7 @@ public static async Task BanSilently(DiscordGuild targetGuild, ulong targe try { await targetGuild.BanMemberAsync(targetUserId, TimeSpan.FromDays(7), reason); - + // Remove user message tracking if (await Program.db.SetContainsAsync("trackedUsers", targetUserId)) { @@ -168,7 +168,7 @@ await thread.ModifyAsync(thread => thread.IsArchived = true; }); } - + return true; } catch diff --git a/Helpers/MuteHelpers.cs b/Helpers/MuteHelpers.cs index 278cbb1e..80c2a5c2 100644 --- a/Helpers/MuteHelpers.cs +++ b/Helpers/MuteHelpers.cs @@ -258,7 +258,7 @@ public static (int MuteHours, int WarnsSinceThreshold) GetHoursToMuteFor(Diction MessageId = output.dmMessage.Id, ChannelId = output.dmMessage.ChannelId }; - + try { if (permaMute) diff --git a/Structs.cs b/Structs.cs index 8e5316af..50a90a5f 100644 --- a/Structs.cs +++ b/Structs.cs @@ -615,7 +615,7 @@ public class PendingUserOverride { [JsonProperty("channelId")] public ulong ChannelId { get; set; } - + [JsonProperty("overwrite")] public MockUserOverwrite Overwrite { get; set; } } @@ -624,10 +624,10 @@ public class MockUserOverwrite { [JsonProperty("type")] public int Type { get; } = 1; - + [JsonProperty("allow")] public DiscordPermissions Allowed { get; set; } - + [JsonProperty("deny")] public DiscordPermissions Denied { get; set; } diff --git a/Tasks/EventTasks.cs b/Tasks/EventTasks.cs index cba13b72..cefea8cb 100644 --- a/Tasks/EventTasks.cs +++ b/Tasks/EventTasks.cs @@ -4,7 +4,7 @@ public class EventTasks { public static Dictionary PendingChannelUpdateEvents = new(); public static Dictionary PendingChannelDeleteEvents = new(); - + public static async Task HandlePendingChannelUpdateEventsAsync() { bool success = false; @@ -92,7 +92,7 @@ await Program.db.HashSetAsync("overrides", userOverwrites.Name, var dict = JsonConvert.DeserializeObject>(dbOverwrite.Value); dbOverwriteList.Add(dict); } - + // If the overwrite is already in the db for this channel, skip if (dbOverwriteList.Any(dbOverwriteSet => dbOverwriteSet.ContainsKey(e.ChannelAfter.Id) && CompareOverwrites(dbOverwriteSet[e.ChannelAfter.Id], overwrite))) continue; @@ -171,19 +171,19 @@ public static async Task HandlePendingChannelDeleteEventsAsync() try { // Purge all overwrites from db for this channel - + // Get all overwrites var dbOverwrites = await Program.db.HashGetAllAsync("overrides"); - + // Overwrites are stored by user ID, then as a dict with channel ID as key & overwrite as value, so we can't just delete by channel ID. // We need to loop through all overwrites and delete the ones that match the channel ID, then put everything back together. foreach (var userOverwrites in dbOverwrites) { var overwriteDict = JsonConvert.DeserializeObject>(userOverwrites.Value); - + // Now overwriteDict is a dict of this user's overwrites, with channel ID as key & overwrite as value - + // Loop through these; for any with a matching channel ID to the channel that was deleted, remove them foreach (var overwrite in overwriteDict) { @@ -192,10 +192,10 @@ public static async Task HandlePendingChannelDeleteEventsAsync() overwriteDict.Remove(overwrite.Key); } } - + // Now we have a modified overwriteDict (ulong, DiscordOverwrite) // Now we put everything back together - + // If the user now has no overrides, remove them from the db entirely if (overwriteDict.Count == 0) { @@ -207,7 +207,7 @@ public static async Task HandlePendingChannelDeleteEventsAsync() await Program.db.HashSetAsync("overrides", userOverwrites.Name, JsonConvert.SerializeObject(overwriteDict)); } } - + PendingChannelDeleteEvents.Remove(timestamp); success = true; } @@ -226,15 +226,15 @@ public static async Task HandlePendingChannelDeleteEventsAsync() { Program.discord.Logger.LogDebug(ex, "Failed to enumerate pending channel delete events; this usually means a Channel Delete event was just added to the list, or one was processed and removed from the list. Will try again on next task run."); } - + Program.discord.Logger.LogDebug(Program.CliptokEventID, "Checked pending channel delete events at {time} with result: {success}", DateTime.Now, success); return success; } - + private static bool CompareOverwrites(DiscordOverwrite a, DiscordOverwrite b) { // Compares two overwrites. ONLY CHECKS PERMISSIONS, ID, TYPE AND CREATION TIME. Ignores other properties! - + return a.Allowed == b.Allowed && a.Denied == b.Denied && a.Id == b.Id && a.Type == b.Type && a.CreationTimestamp == b.CreationTimestamp; } }