diff --git a/EventHandler.cs b/EventHandler.cs index fb8fde1..e3e3fd6 100644 --- a/EventHandler.cs +++ b/EventHandler.cs @@ -18,6 +18,8 @@ namespace SupportChild; public static class EventHandler { + internal static bool hasLoggedGuilds = false; + public static Task OnReady(DiscordClient client, GuildDownloadCompletedEventArgs e) { Logger.Log("Connected to Discord."); @@ -35,6 +37,12 @@ public static class EventHandler public static async Task OnGuildAvailable(DiscordClient discordClient, GuildAvailableEventArgs e) { + if (hasLoggedGuilds) + { + return; + } + hasLoggedGuilds = true; + Logger.Log("Found Discord server: " + e.Guild.Name + " (" + e.Guild.Id + ")"); if (SupportChild.commandLineArgs.serversToLeave.Contains(e.Guild.Id)) diff --git a/SupportChild.cs b/SupportChild.cs index b719148..183ae85 100644 --- a/SupportChild.cs +++ b/SupportChild.cs @@ -224,6 +224,7 @@ internal static class SupportChild client = clientBuilder.Build(); Logger.Log("Connecting to Discord..."); + EventHandler.hasLoggedGuilds = false; await client.ConnectAsync(); return true; }