Skip to content

Commit 628c9d2

Browse files
committed
fix!: refactor modal components handling in DiscordInteractionData
Renamed ComponentsInternal to ModalComponentsInternal and updated ModalComponents to use the new internal property. Removed the deprecated Components property and its related logic for clarity and maintainability. Also removed an unused using directive in DiscordFileUploadComponent.cs.
1 parent 6314716 commit 628c9d2

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

DisCatSharp/Entities/Components/DiscordFileUploadComponent.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32

43
using DisCatSharp.Enums;
54

DisCatSharp/Entities/Interaction/DiscordInteractionData.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,17 @@ public sealed class DiscordInteractionData : SnowflakeObject
2929
/// Gets the submitted modal components.
3030
/// </summary>
3131
[JsonProperty("components", NullValueHandling = NullValueHandling.Ignore)]
32-
internal List<DiscordComponent> ComponentsInternal { get; set; } = [];
33-
34-
public IReadOnlyList<DiscordComponent> ModalComponents
35-
=> this.ComponentsInternal;
36-
32+
internal List<DiscordComponent> ModalComponentsInternal { get; set; } = [];
33+
3734
/// <summary>
3835
/// Gets the submitted modal components.
3936
/// <para>
4037
/// If you want to get the components, use <see cref="DiscordInteraction" />.
4138
/// <see cref="DiscordInteraction.Message" />.<see cref="DiscordMessage.Components" /> instead.
4239
/// </para>
4340
/// </summary>
44-
[JsonIgnore, DiscordDeprecated("Use ModalComponents instead")]
45-
public IReadOnlyList<DiscordTextInputComponent>? Components
46-
=> this.ComponentsInternal.OfType<DiscordActionRowComponent>()
47-
.SelectMany(x => x.Components.OfType<DiscordTextInputComponent>())
48-
.ToList()
49-
.AsReadOnly();
41+
public IReadOnlyList<DiscordComponent> ModalComponents
42+
=> this.ModalComponentsInternal;
5043

5144
/// <summary>
5245
/// Gets the Discord snowflake objects resolved from this interaction's arguments.

0 commit comments

Comments
 (0)