Only log guilds and roles once after connecting
This commit is contained in:
parent
e3984ab968
commit
12337101b7
2 changed files with 9 additions and 0 deletions
|
@ -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))
|
||||
|
|
|
@ -224,6 +224,7 @@ internal static class SupportChild
|
|||
client = clientBuilder.Build();
|
||||
|
||||
Logger.Log("Connecting to Discord...");
|
||||
EventHandler.hasLoggedGuilds = false;
|
||||
await client.ConnectAsync();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue