Skip to content

Commit

Permalink
debug overrides cleanup: Only rely on cache, do not fetch channels
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Dec 9, 2024
1 parent 679f311 commit 8f0840b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Commands/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,17 +549,8 @@ public async Task CleanUpOverrides(CommandContext ctx)
var overwriteDict = JsonConvert.DeserializeObject<Dictionary<ulong, DiscordOverwrite>>(userOverwrites.Value);
foreach (var overwrite in overwriteDict)
{
bool channelExists = false;
try
{
await Program.discord.GetChannelAsync(overwrite.Key);
channelExists = true;
}
catch (DSharpPlus.Exceptions.NotFoundException)
{
// Channel doesn't exist, leave bool false
}

bool channelExists = Program.discord.Guilds.Any(g => g.Value.Channels.Any(c => c.Key == overwrite.Key));

if (!channelExists)
{
// Channel no longer exists, remove the override
Expand Down

0 comments on commit 8f0840b

Please sign in to comment.