public async Task Sync() { await ReplyAsync("Querying server for guilds registered to bot owner"); var guilds = await _client.GetGuilds(); var replySb = new StringBuilder(); if (guilds.Count == 0) { await ReplyAsync("No guilds could be found"); } for (var i = 0; i < guilds.Count; i++) { var guild = guilds[i]; replySb.Append(guild.Name); if (i == guilds.Count - 1) { replySb.Append("."); break; } replySb.Append(", "); } await ReplyAsync($"{guilds.Count} guild(s) successfully pulled from server: {replySb.ToString()}"); foreach (var guild in guilds) { var characters = await _client.GetCharacters(guild._Id); guild.Characters = characters; _bankService.AddOrUpdateGuild(guild); } await ReplyAsync("Database successfully synced with ClassicGuildBank server"); }