private void UpdateGuildConfigs() { while (true) { Dictionary <ulong, GuildConfig> Configs = new Dictionary <ulong, GuildConfig>(); foreach (var guild in _client.Guilds) { try { if (GuildConfigFunctions.GuildHasConfig(guild, connection)) { Configs.Add(guild.Id, GuildConfigFunctions.GetGuildConfig(guild, connection)); } else { GuildConfigFunctions.CreateGuildConfig(guild, connection); List <EmbedFieldBuilder> fields = new List <EmbedFieldBuilder>(); fields.Add(new EmbedFieldBuilder { Name = "**I'm sorry for being late**", Value = $"We had some technical difficulties.\n" + $"Everything should be normal by now.", IsInline = false }); fields.Add(new EmbedFieldBuilder { Name = "**Please Note**", Value = $"By default, {guild.DefaultChannel.Mention} is the default bot channel.\n" + $"If you want to change it, type {GlobalData.Config.defaultPrefix}whitelist add #YourTextChannel", IsInline = false }); Task.Run(async() => { await guild.DefaultChannel.SendMessageAsync(embed: await EmbedHandler.CreateCustomEmbed( guild: guild, embedTitle: "Oh oh..", fields: fields, color: Color.DarkTeal, footer: $"Thank you for choosing {guild.CurrentUser.Username}" )); }); } } catch (Exception e) { LoggingService.Log("UGC", e.Message, ConsoleColor.Red); } } //LoggingService.Log("UGC", $"Updated all guild configs ({Configs.Count})"); _commandHandler.GuildConfigs = Configs; Thread.Sleep(GlobalData.Config.cacheUpdateTime); } }