diff --git a/NetCord/Rest/ComponentProperties/ComponentSectionProperties.cs b/NetCord/Rest/ComponentProperties/ComponentSectionProperties.cs index b310f3cf..8944777b 100644 --- a/NetCord/Rest/ComponentProperties/ComponentSectionProperties.cs +++ b/NetCord/Rest/ComponentProperties/ComponentSectionProperties.cs @@ -6,7 +6,7 @@ namespace NetCord.Rest; [GenerateMethodsForProperties] -public partial class ComponentSectionProperties(IComponentSectionAccessoryComponentProperties accessory, IEnumerable components) : IMessageComponentProperties, IComponentContainerComponentProperties, IComponentSectionProperties, IEnumerable +public partial class ComponentSectionProperties(IComponentSectionAccessoryComponentProperties accessory, IEnumerable components) : IMessageComponentProperties, IComponentContainerComponentProperties, IComponentSectionProperties, IEnumerable { public ComponentSectionProperties(IComponentSectionAccessoryComponentProperties accessory) : this(accessory, []) { @@ -16,12 +16,12 @@ public ComponentSectionProperties(IComponentSectionAccessoryComponentProperties public ComponentType ComponentType => ComponentType.Section; - public IEnumerable Components { get; set; } = components; + public IEnumerable Components { get; set; } = components; public IComponentSectionAccessoryComponentProperties Accessory { get; set; } = accessory; [EditorBrowsable(EditorBrowsableState.Never)] - public void Add(TextDisplayProperties component) => AddComponents(component); + public void Add(IComponentSectionComponentProperties component) => AddComponents(component); private void WriteTo(Utf8JsonWriter writer) { @@ -38,14 +38,14 @@ void IJsonSerializable.WriteTo(Utf8JsonW WriteTo(writer); } - IEnumerator IEnumerable.GetEnumerator() => Components.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => Components.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)Components).GetEnumerator(); } internal interface IComponentSectionProperties : IComponentProperties { [JsonPropertyName("components")] - public IEnumerable Components { get; } + public IEnumerable Components { get; } [JsonPropertyName("accessory")] public IComponentSectionAccessoryComponentProperties Accessory { get; } diff --git a/NetCord/Rest/ComponentProperties/TextDisplayProperties.cs b/NetCord/Rest/ComponentProperties/TextDisplayProperties.cs index 10063dcc..51c31ef2 100644 --- a/NetCord/Rest/ComponentProperties/TextDisplayProperties.cs +++ b/NetCord/Rest/ComponentProperties/TextDisplayProperties.cs @@ -4,7 +4,7 @@ namespace NetCord.Rest; [GenerateMethodsForProperties] -public partial class TextDisplayProperties(string content) : IMessageComponentProperties, IModalComponentProperties, IComponentContainerComponentProperties +public partial class TextDisplayProperties(string content) : IMessageComponentProperties, IModalComponentProperties, IComponentContainerComponentProperties, IComponentSectionComponentProperties { /// /// Unique identifier for the component. Auto populated through increment if not provided. @@ -38,4 +38,9 @@ void IJsonSerializable.WriteTo(Utf8JsonW { WriteTo(writer); } + + void IJsonSerializable.WriteTo(Utf8JsonWriter writer) + { + WriteTo(writer); + } }