From 296c56ea52e977529ed9967e13156825906f4a2f Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Mon, 20 Jan 2025 13:22:56 +0100 Subject: [PATCH] feat: implement membership application stuff --- .../Guild/DiscordGuildMembershipScreening.cs | 2 +- .../DiscordGuildMembershipScreeningField.cs | 33 +++++++++++++++---- .../Guild/MembershipScreeningFieldType.cs | 20 ++++++++++- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreening.cs b/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreening.cs index 4cb6201788..c0e31339f0 100644 --- a/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreening.cs +++ b/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreening.cs @@ -26,5 +26,5 @@ public class DiscordGuildMembershipScreening : ObservableApiObject /// Gets the server description shown in the screening form. /// [JsonProperty("description")] - public string Description { get; internal set; } + public string? Description { get; internal set; } } diff --git a/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreeningField.cs b/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreeningField.cs index a85c4e5e29..6dfe037b3f 100644 --- a/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreeningField.cs +++ b/DisCatSharp/Entities/Guild/DiscordGuildMembershipScreeningField.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using DisCatSharp.Enums; @@ -10,7 +9,7 @@ namespace DisCatSharp.Entities; /// /// Represents a field in a guild's membership screening form /// -public class DiscordGuildMembershipScreeningField : ObservableApiObject +public sealed class DiscordGuildMembershipScreeningField : ObservableApiObject { /// /// Initializes a new instance of the class. @@ -19,12 +18,16 @@ public class DiscordGuildMembershipScreeningField : ObservableApiObject /// The label. /// The values. /// If true, required. - public DiscordGuildMembershipScreeningField(MembershipScreeningFieldType type, string label, IEnumerable values, bool required = true) + /// The description. + /// The placeholder. + public DiscordGuildMembershipScreeningField(MembershipScreeningFieldType type, string label, List? values = null, bool required = true, string? description = null, string? placeholder = null) { this.Type = type; this.Label = label; - this.Values = values.ToList(); + this.Values = values; this.IsRequired = required; + this.Description = description; + this.Placeholder = placeholder; } /// @@ -49,11 +52,29 @@ internal DiscordGuildMembershipScreeningField() /// Gets the list of rules /// [JsonProperty("values", NullValueHandling = NullValueHandling.Ignore)] - public IReadOnlyList Values { get; internal set; } + public IReadOnlyList? Values { get; internal set; } - /// + /// . /// Gets whether the user has to fill out this field /// [JsonProperty("required", NullValueHandling = NullValueHandling.Ignore)] public bool IsRequired { get; internal set; } + + /// + /// Gets the placeholder. + /// + [JsonProperty("placeholder", NullValueHandling = NullValueHandling.Ignore)] + public string? Placeholder { get; internal set; } + + /// + /// Gets the placeholder. + /// + [JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)] + public string? Description { get; internal set; } + + /// + /// Gets the placeholder. + /// + [JsonProperty("automations", NullValueHandling = NullValueHandling.Ignore)] + public object? Automations { get; internal set; } } diff --git a/DisCatSharp/Enums/Guild/MembershipScreeningFieldType.cs b/DisCatSharp/Enums/Guild/MembershipScreeningFieldType.cs index fa2aaf2fad..26b5d50d1d 100644 --- a/DisCatSharp/Enums/Guild/MembershipScreeningFieldType.cs +++ b/DisCatSharp/Enums/Guild/MembershipScreeningFieldType.cs @@ -15,5 +15,23 @@ public enum MembershipScreeningFieldType /// Specifies the server rules /// [EnumMember(Value = "TERMS")] - Terms + Terms, + + /// + /// Specifies a text input question. + /// + [EnumMember(Value = "TEXT_INPUT")] + TextInput, + + /// + /// Specifies a paragraph question. + /// + [EnumMember(Value = "PARAGRAPH")] + Paragraph, + + /// + /// Specifies a multiple choice question. + /// + [EnumMember(Value = "MULTIPLE_CHOICE")] + MultipleChoice }