[Feature] Guild Onboarding support (#2616)

* api models

* moar models

* complete models

* modelsss

* forgot to push

* oh lol forgot this too

* api & rest guild method

* revert VS being VS & formatting to file scoped namespace

* socket entities

* yup

* fix xml doc

* changes
This commit is contained in:
Misha133
2023-04-15 02:08:30 +03:00
committed by GitHub
parent 84431decfd
commit 3a8f76c4b1
18 changed files with 574 additions and 3 deletions

View File

@@ -1307,5 +1307,13 @@ namespace Discord
/// A task that represents the asynchronous creation operation. The task result contains the created <see cref="IAutoModRule"/>.
/// </returns>
Task<IAutoModRule> CreateAutoModRuleAsync(Action<AutoModRuleProperties> props, RequestOptions options = null);
/// <summary>
/// Gets the onboarding object configured for the guild.
/// </summary>
/// <returns>
/// A task that represents the asynchronous creation operation. The task result contains the created <see cref="IGuildOnboarding"/>.
/// </returns>
Task<IGuildOnboarding> GetOnboardingAsync(RequestOptions options = null);
}
}

View File

@@ -0,0 +1,17 @@
namespace Discord;
/// <summary>
/// Represents the guild onboarding option type.
/// </summary>
public enum GuildOnboardingPromptType
{
/// <summary>
/// The prompt accepts multiple choices.
/// </summary>
MultipleChoice = 0,
/// <summary>
/// The prompt uses a dropdown menu.
/// </summary>
Dropdown = 1,
}

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
namespace Discord;
/// <summary>
/// Represents the guild onboarding flow.
/// </summary>
public interface IGuildOnboarding
{
/// <summary>
/// Gets the ID of the guild this onboarding is part of.
/// </summary>
ulong GuildId { get; }
/// <summary>
/// Gets the guild this onboarding is part of.
/// </summary>
IGuild Guild { get; }
/// <summary>
/// Gets prompts shown during onboarding and in customize community.
/// </summary>
IReadOnlyCollection<IGuildOnboardingPrompt> Prompts { get; }
/// <summary>
/// Gets IDs of channels that members get opted into automatically.
/// </summary>
IReadOnlyCollection<ulong> DefaultChannelIds { get; }
/// <summary>
/// Gets whether onboarding is enabled in the guild.
/// </summary>
bool IsEnabled { get; }
}

View File

@@ -0,0 +1,40 @@
using System.Collections.Generic;
namespace Discord;
/// <summary>
/// Represents the guild onboarding prompt.
/// </summary>
public interface IGuildOnboardingPrompt : ISnowflakeEntity
{
/// <summary>
/// Gets options available within the prompt.
/// </summary>
IReadOnlyCollection<IGuildOnboardingPromptOption> Options { get; }
/// <summary>
/// Gets the title of the prompt.
/// </summary>
string Title { get; }
/// <summary>
/// Indicates whether users are limited to selecting one option for the prompt.
/// </summary>
bool IsSingleSelect { get; }
/// <summary>
/// Indicates whether the prompt is required before a user completes the onboarding flow.
/// </summary>
bool IsRequired { get; }
/// <summary>
/// Indicates whether the prompt is present in the onboarding flow.
/// If <see langword="false"/>, the prompt will only appear in the Channels and Roles tab.
/// </summary>
bool IsInOnboarding { get; }
/// <summary>
/// Gets the type of the prompt.
/// </summary>
GuildOnboardingPromptType Type { get; }
}

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
namespace Discord;
/// <summary>
/// Represents the guild onboarding prompt option.
/// </summary>
public interface IGuildOnboardingPromptOption : ISnowflakeEntity
{
/// <summary>
/// Gets IDs of channels a member is added to when the option is selected.
/// </summary>
IReadOnlyCollection<ulong> ChannelIds { get; }
/// <summary>
/// Gets IDs of roles assigned to a member when the option is selected.
/// </summary>
IReadOnlyCollection<ulong> RoleIds { get; }
/// <summary>
/// Gets the emoji of the option. <see langword="null"/> if none is set.
/// </summary>
IEmote Emoji { get; }
/// <summary>
/// Gets the title of the option.
/// </summary>
string Title { get; }
/// <summary>
/// Gets the description of the option. <see langword="null"/> if none is set.
/// </summary>
string Description { get; }
}