From fbce842979bdabe156be19aa58c6435e4aae421a Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sun, 9 Apr 2017 16:19:21 -0400 Subject: [PATCH] Expose the 'Fields' collection on EmbedBuilder After some discussion I decided that there was really no reason to keep this private, and it didn't really go along with the rest of the design of the EmbedBuilder. This is NOT a breaking change. Exposing this property should not have any negative effects. --- .../Entities/Messages/EmbedBuilder.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs b/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs index 74f1441e1..ab1ebdf37 100644 --- a/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs +++ b/src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs @@ -7,12 +7,11 @@ namespace Discord public class EmbedBuilder { private readonly Embed _embed; - private readonly List _fields; public EmbedBuilder() { _embed = new Embed("rich"); - _fields = new List(); + Fields = new List(); } public string Title { get { return _embed.Title; } set { _embed.Title = value; } } @@ -25,6 +24,7 @@ namespace Discord public EmbedAuthorBuilder Author { get; set; } public EmbedFooterBuilder Footer { get; set; } + public List Fields { get; set; } public EmbedBuilder WithTitle(string title) { @@ -98,7 +98,7 @@ namespace Discord .WithIsInline(false) .WithName(name) .WithValue(value); - _fields.Add(field); + Fields.Add(field); return this; } public EmbedBuilder AddInlineField(string name, object value) @@ -107,19 +107,19 @@ namespace Discord .WithIsInline(true) .WithName(name) .WithValue(value); - _fields.Add(field); + Fields.Add(field); return this; } public EmbedBuilder AddField(EmbedFieldBuilder field) { - _fields.Add(field); + Fields.Add(field); return this; } public EmbedBuilder AddField(Action action) { var field = new EmbedFieldBuilder(); action(field); - _fields.Add(field); + Fields.Add(field); return this; } @@ -127,9 +127,9 @@ namespace Discord { _embed.Footer = Footer?.Build(); _embed.Author = Author?.Build(); - var fields = ImmutableArray.CreateBuilder(_fields.Count); - for (int i = 0; i < _fields.Count; i++) - fields.Add(_fields[i].Build()); + var fields = ImmutableArray.CreateBuilder(Fields.Count); + for (int i = 0; i < Fields.Count; i++) + fields.Add(Fields[i].Build()); _embed.Fields = fields.ToImmutable(); return _embed; }