Skip to content

Commit

Permalink
feat: implement membership application stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 20, 2025
1 parent 20e2d1d commit 296c56e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ public class DiscordGuildMembershipScreening : ObservableApiObject
/// Gets the server description shown in the screening form.
/// </summary>
[JsonProperty("description")]
public string Description { get; internal set; }
public string? Description { get; internal set; }
}
33 changes: 27 additions & 6 deletions DisCatSharp/Entities/Guild/DiscordGuildMembershipScreeningField.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Linq;

using DisCatSharp.Enums;

Expand All @@ -10,7 +9,7 @@ namespace DisCatSharp.Entities;
/// <summary>
/// Represents a field in a guild's membership screening form
/// </summary>
public class DiscordGuildMembershipScreeningField : ObservableApiObject
public sealed class DiscordGuildMembershipScreeningField : ObservableApiObject
{
/// <summary>
/// Initializes a new instance of the <see cref="DiscordGuildMembershipScreeningField" /> class.
Expand All @@ -19,12 +18,16 @@ public class DiscordGuildMembershipScreeningField : ObservableApiObject
/// <param name="label">The label.</param>
/// <param name="values">The values.</param>
/// <param name="required">If true, required.</param>
public DiscordGuildMembershipScreeningField(MembershipScreeningFieldType type, string label, IEnumerable<string> values, bool required = true)
/// <param name="description">The description.</param>
/// <param name="placeholder">The placeholder.</param>
public DiscordGuildMembershipScreeningField(MembershipScreeningFieldType type, string label, List<string>? 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;
}

/// <summary>
Expand All @@ -49,11 +52,29 @@ internal DiscordGuildMembershipScreeningField()
/// Gets the list of rules
/// </summary>
[JsonProperty("values", NullValueHandling = NullValueHandling.Ignore)]
public IReadOnlyList<string> Values { get; internal set; }
public IReadOnlyList<string>? Values { get; internal set; }

/// <summary>
/// <summary>.
/// Gets whether the user has to fill out this field
/// </summary>
[JsonProperty("required", NullValueHandling = NullValueHandling.Ignore)]
public bool IsRequired { get; internal set; }

/// <summary>
/// Gets the placeholder.
/// </summary>
[JsonProperty("placeholder", NullValueHandling = NullValueHandling.Ignore)]
public string? Placeholder { get; internal set; }

/// <summary>
/// Gets the placeholder.
/// </summary>
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public string? Description { get; internal set; }

/// <summary>
/// Gets the placeholder.
/// </summary>
[JsonProperty("automations", NullValueHandling = NullValueHandling.Ignore)]
public object? Automations { get; internal set; }
}
20 changes: 19 additions & 1 deletion DisCatSharp/Enums/Guild/MembershipScreeningFieldType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,23 @@ public enum MembershipScreeningFieldType
/// Specifies the server rules
/// </summary>
[EnumMember(Value = "TERMS")]
Terms
Terms,

/// <summary>
/// Specifies a text input question.
/// </summary>
[EnumMember(Value = "TEXT_INPUT")]
TextInput,

/// <summary>
/// Specifies a paragraph question.
/// </summary>
[EnumMember(Value = "PARAGRAPH")]
Paragraph,

/// <summary>
/// Specifies a multiple choice question.
/// </summary>
[EnumMember(Value = "MULTIPLE_CHOICE")]
MultipleChoice
}

0 comments on commit 296c56e

Please sign in to comment.