public Settlement FromEmbed(IEmbed embed) { if (!embed.Description.Contains(SettlementResources.Settlement)) { throw new ArgumentException(SettlementResources.SettlementNotFoundError); } this.Authority = embed.Fields.FirstOrDefault(fld => fld.Name == SettlementResources.Authority).Value; this.FirstLooks = embed.Fields.Where(fld => fld.Name == SettlementResources.FirstLook)?.Select(item => item.Value).ToList() ?? new List <string>(); this.FirstLooksToReveal = FirstLooks.Count(); this.InitialContactRevealed = embed.Fields.Any(fld => fld.Name == SettlementResources.InitialContact); if (InitialContactRevealed) { this.InitialContact = embed.Fields.FirstOrDefault(fld => fld.Name == SettlementResources.InitialContact).Value; } this.Location = embed.Fields.FirstOrDefault(fld => fld.Name == SettlementResources.Location).Value; this.Name = embed.Title.Replace("__", ""); this.Population = embed.Fields.FirstOrDefault(fld => fld.Name == SettlementResources.Population).Value; this.Projects = embed.Fields.Where(fld => fld.Name == SettlementResources.SettlementProjects)?.Select(item => item.Value).ToList() ?? new List <string>(); this.ProjectsRevealed = embed.Fields.Count(fld => fld.Name.Contains(SettlementResources.SettlementProjects)); this.Region = StarforgedUtilites.GetAnySpaceRegion(embed.Description); this.SettlementTroubleRevealed = embed.Fields.Any(fld => fld.Name == SettlementResources.SettlementTrouble); if (SettlementTroubleRevealed) { this.SettlementTrouble = embed.Fields.FirstOrDefault(fld => fld.Name == SettlementResources.SettlementTrouble).Value; } this.IconUrl = embed.Thumbnail?.Url; return(this); }