[Features] Automod member profile moderation, new application fields, use clyde ai & guild invenory settings (#2791)

* guild inventory settings

* `UseClydeAI` (1L << 47) permission

* automod member profile moderation

* Dnet: The Enums update (new application fields)

* ah yeah, `IApplication`

* some oversights

* y did I change this

* oh bruh nvm

* `CreateGuildExpressions` permission

---------

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
Mihail Gribkov
2023-11-19 00:15:20 +03:00
committed by GitHub
parent 89bebc361a
commit 699554ad11
28 changed files with 680 additions and 107 deletions

View File

@@ -0,0 +1,34 @@
namespace Discord;
public enum ApplicationDiscoverabilityState
{
/// <summary>
/// Application has no discoverability state.
/// </summary>
None = 0,
/// <summary>
/// Application is ineligible for the application directory.
/// </summary>
Ineligible = 1,
/// <summary>
/// Application is not listed in the application directory.
/// </summary>
NotDiscoverable = 2,
/// <summary>
/// Application is listed in the application directory.
/// </summary>
Discoverable = 3,
/// <summary>
/// Application is featureable in the application directory.
/// </summary>
Featureable = 4,
/// <summary>
/// Application has been blocked from appearing in the application directory.
/// </summary>
Blocked = 5,
}

View File

@@ -0,0 +1,14 @@
namespace Discord;
public enum ApplicationExplicitContentFilterLevel
{
/// <summary>
/// Media content will not be filtered.
/// </summary>
Disabled = 0,
/// <summary>
/// Media content will be filtered.
/// </summary>
Enabled = 1,
}

View File

@@ -0,0 +1,14 @@
namespace Discord;
public enum ApplicationInteractionsVersion
{
/// <summary>
/// Only Interaction Create events are sent as documented (default).
/// </summary>
Version1 = 1,
/// <summary>
/// A selection of chosen events are sent.
/// </summary>
Version2 = 2,
}

View File

@@ -0,0 +1,80 @@
using System;
namespace Discord;
/// <summary>
/// Gets the monetization eligibility flags for the application combined as a bitfield.
/// </summary>
[Flags]
public enum ApplicationMonetizationEligibilityFlags
{
/// <summary>
/// The application has no monetization eligibility flags set.
/// </summary>
None = 0,
/// <summary>
/// Application is verified.
/// </summary>
Verified = 1 << 0,
/// <summary>
/// Application is owned by a team.
/// </summary>
HasTeam = 1 << 1,
/// <summary>
/// Application has the message content intent approved or uses application commands.
/// </summary>
ApprovedCommands = 1 << 2,
/// <summary>
/// Application has terms of service set.
/// </summary>
TermsOfService = 1 << 3,
/// <summary>
/// Application has a privacy policy set.
/// </summary>
PrivacyPolicy = 1 << 4,
/// <summary>
/// Application's name is safe for work.
/// </summary>
SafeName = 1 << 5,
/// <summary>
/// Application's description is safe for work.
/// </summary>
SafeDescription = 1 << 6,
/// <summary>
/// Application's role connections metadata is safe for work.
/// </summary>
SafeRoleConnections = 1 << 7,
/// <summary>
/// Application is not quarantined.
/// </summary>
NotQuarantined = 1 << 9,
/// <summary>
/// Application's team members all have verified emails.
/// </summary>
TeamMembersEmailVerified = 1 << 15,
/// <summary>
/// Application's team members all have MFA enabled.
/// </summary>
TeamMembersMfaEnabled = 1 << 16,
/// <summary>
/// Application has no issues blocking monetization.
/// </summary>
NoBlockingIssues = 1 << 17,
/// <summary>
/// Application's team has a valid payout status.
/// </summary>
ValidPayoutStatus = 1 << 18,
}

View File

@@ -0,0 +1,19 @@
namespace Discord;
public enum ApplicationMonetizationState
{
/// <summary>
/// Application has no monetization set up.
/// </summary>
None = 1,
/// <summary>
/// Application has monetization set up.
/// </summary>
Enabled = 2,
/// <summary>
/// Application has been blocked from monetizing.
/// </summary>
Blocked = 3,
}

View File

@@ -0,0 +1,29 @@
namespace Discord;
public enum ApplicationRpcState
{
/// <summary>
/// Application does not have access to RPC.
/// </summary>
Disabled = 0,
/// <summary>
/// Application has not yet been applied for RPC access.
/// </summary>
Unsubmitted = 1,
/// <summary>
/// Application has submitted a RPC access request.
/// </summary>
Submitted = 2,
/// <summary>
/// Application has been approved for RPC access.
/// </summary>
Approved = 3,
/// <summary>
/// Application has been rejected from RPC access.
/// </summary>
Rejected = 4,
}

View File

@@ -0,0 +1,29 @@
namespace Discord;
public enum ApplicationStoreState
{
/// <summary>
/// Application does not have a commerce license.
/// </summary>
None = 1,
/// <summary>
/// Application has a commerce license but has not yet submitted a store approval request.
/// </summary>
Paid = 2,
/// <summary>
/// Application has submitted a store approval request.
/// </summary>
Submitted = 3,
/// <summary>
/// Application has been approved for the store.
/// </summary>
Approved = 4,
/// <summary>
/// Application has been rejected from the store.
/// </summary>
Rejected = 5,
}

View File

@@ -0,0 +1,24 @@
namespace Discord;
public enum ApplicationVerificationState
{
/// <summary>
/// Application is ineligible for verification.
/// </summary>
Ineligible = 1,
/// <summary>
/// Application has not yet been applied for verification.
/// </summary>
Unsubmitted = 2,
/// <summary>
/// Application has submitted a verification request.
/// </summary>
Submitted = 3,
/// <summary>
/// Application has been verified.
/// </summary>
Succeeded = 4,
}

View File

@@ -0,0 +1,100 @@
using System;
namespace Discord;
/// <summary>
/// Gets the discovery eligibility flags for the application combined as a bitfield.
/// </summary>
[Flags]
public enum DiscoveryEligibilityFlags
{
/// <summary>
/// The application has no eligibility flags.
/// </summary>
None = 0,
/// <summary>
/// Application is verified.
/// </summary>
Verified = 1 << 0,
/// <summary>
/// Application has at least one tag set.
/// </summary>
Tag = 1 << 1,
/// <summary>
/// Application has a description.
/// </summary>
Description = 1 << 2,
/// <summary>
/// Application has terms of service set.
/// </summary>
TermsOfService = 1 << 3,
/// <summary>
/// Application has a privacy policy set.
/// </summary>
PrivacyPolicy = 1 << 4,
/// <summary>
/// Application has a custom install URL or install parameters.
/// </summary>
InstallParams = 1 << 5,
/// <summary>
/// Application's name is safe for work.
/// </summary>
SafeName = 1 << 6,
/// <summary>
/// Application's description is safe for work.
/// </summary>
SafeDescription = 1 << 7,
/// <summary>
/// Application has the message content intent approved or uses application commands.
/// </summary>
ApprovedCommands = 1 << 8,
/// <summary>
/// Application has a support guild set.
/// </summary>
SupportGuild = 1 << 9,
/// <summary>
/// Application's commands are safe for work.
/// </summary>
SafeCommands = 1 << 10,
/// <summary>
/// Application's owner has MFA enabled.
/// </summary>
MfaEnabled = 1 << 11,
/// <summary>
/// Application's directory long description is safe for work.
/// </summary>
SafeDirectoryOverview = 1 << 12,
/// <summary>
/// Application has at least one supported locale set.
/// </summary>
SupportedLocales = 1 << 13,
/// <summary>
/// Application's directory short description is safe for work.
/// </summary>
SafeShortDescription = 1 << 14,
/// <summary>
/// Application's role connections metadata is safe for work.
/// </summary>
SafeRoleConnections = 1 << 15,
/// <summary>
/// Application is eligible for discovery.
/// </summary>
Eligible = 1 << 16,
}

View File

@@ -54,45 +54,105 @@ namespace Discord
/// <summary>
/// Gets the url of the app's terms of service.
/// </summary>
public string TermsOfService { get; }
string TermsOfService { get; }
/// <summary>
/// Gets the the url of the app's privacy policy.
/// </summary>
public string PrivacyPolicy { get; }
string PrivacyPolicy { get; }
/// <summary>
/// Gets application's default custom authorization url. <see langword="null" /> if disabled.
/// </summary>
public string CustomInstallUrl { get; }
string CustomInstallUrl { get; }
/// <summary>
/// Gets the application's role connection verification entry point. <see langword="null" /> if not set.
/// </summary>
public string RoleConnectionsVerificationUrl { get; }
string RoleConnectionsVerificationUrl { get; }
/// <summary>
/// Gets the hex encoded key for verification in interactions.
/// </summary>
public string VerifyKey { get; }
string VerifyKey { get; }
/// <summary>
/// Gets the partial guild object of the application's developer's support server. <see langword="null" /> if not set.
/// </summary>
public PartialGuild Guild { get; }
PartialGuild Guild { get; }
/// <summary>
/// Gets the redirect uris configured for the application.
/// </summary>
public IReadOnlyCollection<string> RedirectUris { get;}
IReadOnlyCollection<string> RedirectUris { get;}
/// <summary>
/// Gets application's interactions endpoint url. <see langword="null" /> if not set.
/// </summary>
public string InteractionsEndpointUrl { get; }
string InteractionsEndpointUrl { get; }
/// <summary>
/// Gets the approximate count of the guild the application was added to. <see langword="null" /> if not returned.
/// </summary>
public int? ApproximateGuildCount { get; }
int? ApproximateGuildCount { get; }
/// <summary>
/// Gets the application's discoverability state.
/// </summary>
ApplicationDiscoverabilityState DiscoverabilityState { get; }
/// <summary>
/// Gets the application's discovery eligibility flags.
/// </summary>
DiscoveryEligibilityFlags DiscoveryEligibilityFlags { get; }
/// <summary>
/// Gets the application's explicit content filter level for uploaded media content used in application commands.
/// </summary>
ApplicationExplicitContentFilterLevel ExplicitContentFilterLevel { get; }
/// <summary>
/// Gets whether the bot is allowed to hook into the application's game directly.
/// </summary>
bool IsHook { get; }
/// <summary>
/// Gets event types to be sent to the interaction endpoint.
/// </summary>
IReadOnlyCollection<string> InteractionEventTypes { get; }
/// <summary>
/// Gets the interactions version application uses.
/// </summary>
ApplicationInteractionsVersion InteractionsVersion { get; }
/// <summary>
/// Whether the application has premium subscriptions.
/// </summary>
bool IsMonetized { get; }
/// <summary>
/// Gets the application's monetization eligibility flags.
/// </summary>
ApplicationMonetizationEligibilityFlags MonetizationEligibilityFlags { get; }
/// <summary>
/// Gets the application's monetization state.
/// </summary>
ApplicationMonetizationState MonetizationState { get; }
/// <summary>
/// Gets the application's rpc state.
/// </summary>
ApplicationRpcState RpcState { get; }
/// <summary>
/// Gets the application's store state.
/// </summary>
ApplicationStoreState StoreState { get; }
/// <summary>
/// Gets the application's verification state.
/// </summary>
ApplicationVerificationState VerificationState { get; }
}
}

View File

@@ -1,26 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Discord;
namespace Discord
public enum AutoModActionType
{
public enum AutoModActionType
{
/// <summary>
/// Blocks the content of a message according to the rule.
/// </summary>
BlockMessage = 1,
/// <summary>
/// Blocks the content of a message according to the rule.
/// </summary>
BlockMessage = 1,
/// <summary>
/// Logs user content to a specified channel.
/// </summary>
SendAlertMessage = 2,
/// <summary>
/// Logs user content to a specified channel.
/// </summary>
SendAlertMessage = 2,
/// <summary>
/// Timeout user for a specified duration.
/// </summary>
Timeout = 3,
}
/// <summary>
/// Timeout user for a specified duration.
/// </summary>
Timeout = 3,
/// <summary>
/// Prevents a member from using text, voice, or other interactions.
/// </summary>
BlockMemberInteraction = 4
}

View File

@@ -1,19 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Discord;
namespace Discord
/// <summary>
/// An enum indecating in what event context a rule should be checked.
/// </summary>
public enum AutoModEventType
{
/// <summary>
/// An enum indecating in what event context a rule should be checked.
/// When a member sends or edits a message in the guild.
/// </summary>
public enum AutoModEventType
{
/// <summary>
/// When a member sends or edits a message in the guild.
/// </summary>
MessageSend = 1
}
MessageSend = 1,
/// <summary>
/// When a member edits their profile.
/// </summary>
MemberUpdate = 2
}

View File

@@ -35,5 +35,10 @@ namespace Discord
/// Check if content contains more unique mentions than allowed.
/// </summary>
MentionSpam = 5,
/// <summary>
/// Check if member profile contains words from a user defined list of keywords.
/// </summary>
MemberProfile = 6
}
}

View File

@@ -0,0 +1,14 @@
namespace Discord;
public struct GuildInventorySettings
{
/// <summary>
/// Gets whether everyone can collect the pack to use emojis across servers.
/// </summary>
public bool IsEmojiPackCollectible { get; }
internal GuildInventorySettings(bool isEmojiPackCollectible)
{
IsEmojiPackCollectible = isEmojiPackCollectible;
}
}

View File

@@ -376,6 +376,11 @@ namespace Discord
/// </summary>
ulong MaxUploadLimit { get; }
/// <summary>
/// Get the inventory settings on the guild. <see langword="null"/> if not available in the guild.
/// </summary>
GuildInventorySettings? InventorySettings { get; }
/// <summary>
/// Gets the incidents data for this guild.
/// </summary>

View File

@@ -183,6 +183,11 @@ namespace Discord
/// </summary>
SendVoiceMessages = 1L << 46,
/// <summary>
/// Allows members to interact with the Clyde AI bot.
/// </summary>
UseClydeAI = 1L << 47,
/// <summary>
/// Allows setting voice channel status.
/// </summary>

View File

@@ -18,17 +18,17 @@ namespace Discord
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels.
/// </summary>
public static readonly ChannelPermissions Text = new(0b10001_001111_110010_110011_111101_111111_111101_010001);
public static readonly ChannelPermissions Text = new(0b110001_001111_110010_110011_111101_111111_111101_010001);
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels.
/// </summary>
public static readonly ChannelPermissions Voice = new(0b1_010001_001010_001010_110011_111101_111111_111101_010001);
public static readonly ChannelPermissions Voice = new(0b1_110001_001010_001010_110011_111101_111111_111101_010001);
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for stage channels.
/// </summary>
public static readonly ChannelPermissions Stage = new(0b10000_000010_001110_010001_010101_111111_111001_010001);
public static readonly ChannelPermissions Stage = new(0b110000_000010_001110_010001_010101_111111_111001_010001);
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for category channels.
@@ -48,7 +48,7 @@ namespace Discord
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for forum channels.
/// </summary>
public static readonly ChannelPermissions Forum = new(0b01_001110_010010_110011_111101_111111_111101_010001);
public static readonly ChannelPermissions Forum = new(0b000001_001110_010010_110011_111101_111111_111101_010001);
/// <summary>
/// Gets a <see cref="ChannelPermissions"/> that grants all permissions for media channels.
@@ -148,10 +148,11 @@ namespace Discord
public bool CreateEvents => Permissions.GetValue(RawValue, ChannelPermission.CreateEvents);
/// <summary> If <see langword="true"/>, a user can send voice messages in this channel.</summary>
public bool SendVoiceMessages => Permissions.GetValue(RawValue, ChannelPermission.SendVoiceMessages);
/// <summary> If <see langword="true"/>, a user can use the Clyde AI bot in this channel.</summary>
public bool UseClydeAI => Permissions.GetValue(RawValue, ChannelPermission.UseClydeAI);
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, GuildPermission.SetVoiceChannelStatus);
/// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided packed value.</summary>
public ChannelPermissions(ulong rawValue) { RawValue = rawValue; }
@@ -189,6 +190,7 @@ namespace Discord
bool? useSoundboard = null,
bool? createEvents = null,
bool? sendVoiceMessages = null,
bool? useClydeAI = null,
bool? setVoiceChannelStatus = null)
{
ulong value = initialValue;
@@ -226,6 +228,7 @@ namespace Discord
Permissions.SetValue(ref value, useSoundboard, ChannelPermission.UseSoundboard);
Permissions.SetValue(ref value, createEvents, ChannelPermission.CreateEvents);
Permissions.SetValue(ref value, sendVoiceMessages, ChannelPermission.SendVoiceMessages);
Permissions.SetValue(ref value, useClydeAI, ChannelPermission.UseClydeAI);
Permissions.SetValue(ref value, setVoiceChannelStatus, ChannelPermission.SetVoiceChannelStatus);
RawValue = value;
@@ -266,12 +269,13 @@ namespace Discord
bool useSoundboard = false,
bool createEvents = false,
bool sendVoiceMessages = false,
bool useClydeAI = false,
bool setVoiceChannelStatus = false)
: this(0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect,
speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, prioritySpeaker, stream, manageRoles, manageWebhooks,
useApplicationCommands, requestToSpeak, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, setVoiceChannelStatus)
startEmbeddedActivities, useSoundboard, createEvents, sendVoiceMessages, useClydeAI, setVoiceChannelStatus)
{ }
/// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions.</summary>
@@ -309,6 +313,7 @@ namespace Discord
bool? useSoundboard = null,
bool? createEvents = null,
bool? sendVoiceMessages = null,
bool? useClydeAI = null,
bool? setVoiceChannelStatus = null)
=> new ChannelPermissions(RawValue,
createInstantInvite,
@@ -344,6 +349,7 @@ namespace Discord
useSoundboard,
createEvents,
sendVoiceMessages,
useClydeAI,
setVoiceChannelStatus);
public bool Has(ChannelPermission permission) => Permissions.GetValue(RawValue, permission);

View File

@@ -263,11 +263,21 @@ namespace Discord
/// </summary>
UseSoundboard = 1L << 42,
/// <summary>
/// Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user.
/// </summary>
CreateGuildExpressions = 1L << 43,
/// <summary>
/// Allows sending voice messages.
/// </summary>
SendVoiceMessages = 1L << 46,
/// <summary>
/// Allows members to interact with the Clyde AI bot.
/// </summary>
UseClydeAI = 1L << 47,
/// <summary>
/// Allows setting voice channel status.
/// </summary>

View File

@@ -108,8 +108,12 @@ namespace Discord
public bool UseSoundboard => Permissions.GetValue(RawValue, GuildPermission.UseSoundboard);
/// <summary> If <see langword="true"/>, a user can view monetization analytics in this guild.</summary>
public bool ViewMonetizationAnalytics => Permissions.GetValue(RawValue, GuildPermission.ViewMonetizationAnalytics);
/// <summary> If <see langword="true"/>, a user can send voice messages in this channel.</summary>
/// <summary> If <see langword="true"/>, a user can send voice messages in this guild.</summary>
public bool SendVoiceMessages => Permissions.GetValue(RawValue, GuildPermission.SendVoiceMessages);
/// <summary> If <see langword="true"/>, a user can use the Clyde AI bot in this guild.</summary>
public bool UseClydeAI => Permissions.GetValue(RawValue, GuildPermission.UseClydeAI);
/// <summary> If <see langword="true"/>, a user can create guild expressions in this guild.</summary>
public bool CreateGuildExpressions => Permissions.GetValue(RawValue, GuildPermission.CreateGuildExpressions);
/// <summary> If <see langword="true"/>, a user can set the status of a voice channel.</summary>
public bool SetVoiceChannelStatus => Permissions.GetValue(RawValue, GuildPermission.SetVoiceChannelStatus);
@@ -164,6 +168,8 @@ namespace Discord
bool? useSoundboard = null,
bool? viewMonetizationAnalytics = null,
bool? sendVoiceMessages = null,
bool? useClydeAI = null,
bool? createGuildExpressions = null,
bool? setVoiceChannelStatus = null)
{
ulong value = initialValue;
@@ -212,6 +218,8 @@ namespace Discord
Permissions.SetValue(ref value, useSoundboard, GuildPermission.UseSoundboard);
Permissions.SetValue(ref value, viewMonetizationAnalytics, GuildPermission.ViewMonetizationAnalytics);
Permissions.SetValue(ref value, sendVoiceMessages, GuildPermission.SendVoiceMessages);
Permissions.SetValue(ref value, useClydeAI, GuildPermission.UseClydeAI);
Permissions.SetValue(ref value, createGuildExpressions, GuildPermission.CreateGuildExpressions);
Permissions.SetValue(ref value, setVoiceChannelStatus, GuildPermission.SetVoiceChannelStatus);
RawValue = value;
@@ -263,6 +271,8 @@ namespace Discord
bool useSoundboard = false,
bool viewMonetizationAnalytics = false,
bool sendVoiceMessages = false,
bool useClydeAI = false,
bool createGuildExpressions = false,
bool setVoiceChannelStatus = false)
: this(0,
createInstantInvite: createInstantInvite,
@@ -309,6 +319,8 @@ namespace Discord
useSoundboard: useSoundboard,
viewMonetizationAnalytics: viewMonetizationAnalytics,
sendVoiceMessages: sendVoiceMessages,
useClydeAI: useClydeAI,
createGuildExpressions: createGuildExpressions,
setVoiceChannelStatus: setVoiceChannelStatus)
{ }
@@ -358,13 +370,15 @@ namespace Discord
bool? useSoundboard = null,
bool? viewMonetizationAnalytics = null,
bool? sendVoiceMessages = null,
bool? useClydeAI = null,
bool? createGuildExpressions = null,
bool? setVoiceChannelStatus = null)
=> new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions,
viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojisAndStickers,
useApplicationCommands, requestToSpeak, manageEvents, manageThreads, createPublicThreads, createPrivateThreads, useExternalStickers, sendMessagesInThreads,
startEmbeddedActivities, moderateMembers, useSoundboard, viewMonetizationAnalytics, sendVoiceMessages, setVoiceChannelStatus);
startEmbeddedActivities, moderateMembers, useSoundboard, viewMonetizationAnalytics, sendVoiceMessages, useClydeAI, createGuildExpressions, setVoiceChannelStatus);
/// <summary>
/// Returns a value that indicates if a specific <see cref="GuildPermission"/> is enabled

View File

@@ -1,63 +1,97 @@
using Newtonsoft.Json;
namespace Discord.API
namespace Discord.API;
internal class Application
{
internal class Application
{
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("rpc_origins")]
public Optional<string[]> RPCOrigins { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("icon")]
public string Icon { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("rpc_origins")]
public Optional<string[]> RPCOrigins { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("id")]
public ulong Id { get; set; }
[JsonProperty("icon")]
public string Icon { get; set; }
[JsonProperty("bot_public")]
public Optional<bool> IsBotPublic { get; set; }
[JsonProperty("bot_require_code_grant")]
public Optional<bool> BotRequiresCodeGrant { get; set; }
[JsonProperty("bot_public")]
public Optional<bool> IsBotPublic { get; set; }
[JsonProperty("bot_require_code_grant")]
public Optional<bool> BotRequiresCodeGrant { get; set; }
[JsonProperty("install_params")]
public Optional<InstallParams> InstallParams { get; set; }
[JsonProperty("team")]
public Team Team { get; set; }
[JsonProperty("flags"), Int53]
public Optional<ApplicationFlags> Flags { get; set; }
[JsonProperty("owner")]
public Optional<User> Owner { get; set; }
[JsonProperty("tags")]
public Optional<string[]> Tags { get; set; }
[JsonProperty("install_params")]
public Optional<InstallParams> InstallParams { get; set; }
[JsonProperty("team")]
public Team Team { get; set; }
[JsonProperty("flags"), Int53]
public Optional<ApplicationFlags> Flags { get; set; }
[JsonProperty("owner")]
public Optional<User> Owner { get; set; }
[JsonProperty("tags")]
public Optional<string[]> Tags { get; set; }
[JsonProperty("verify_key")]
public string VerifyKey { get; set; }
[JsonProperty("verify_key")]
public string VerifyKey { get; set; }
[JsonProperty("approximate_guild_count")]
public Optional<int> ApproximateGuildCount { get; set; }
[JsonProperty("approximate_guild_count")]
public Optional<int> ApproximateGuildCount { get; set; }
[JsonProperty("guild")]
public Optional<PartialGuild> PartialGuild { get; set; }
[JsonProperty("guild")]
public Optional<PartialGuild> PartialGuild { get; set; }
/// Urls
[JsonProperty("terms_of_service_url")]
public string TermsOfService { get; set; }
/// Urls
[JsonProperty("terms_of_service_url")]
public string TermsOfService { get; set; }
[JsonProperty("privacy_policy_url")]
public string PrivacyPolicy { get; set; }
[JsonProperty("privacy_policy_url")]
public string PrivacyPolicy { get; set; }
[JsonProperty("custom_install_url")]
public Optional<string> CustomInstallUrl { get; set; }
[JsonProperty("custom_install_url")]
public Optional<string> CustomInstallUrl { get; set; }
[JsonProperty("role_connections_verification_url")]
public Optional<string> RoleConnectionsUrl { get; set; }
[JsonProperty("role_connections_verification_url")]
public Optional<string> RoleConnectionsUrl { get; set; }
[JsonProperty("interactions_endpoint_url")]
public Optional<string> InteractionsEndpointUrl { get; set; }
[JsonProperty("interactions_endpoint_url")]
public Optional<string> InteractionsEndpointUrl { get; set; }
[JsonProperty("redirect_uris")]
public Optional<string[]> RedirectUris { get; set; }
[JsonProperty("redirect_uris")]
public Optional<string[]> RedirectUris { get; set; }
}
[JsonProperty("discoverability_state")]
public Optional<ApplicationDiscoverabilityState> DiscoverabilityState { get; set; }
[JsonProperty("discovery_eligibility_flags")]
public Optional<DiscoveryEligibilityFlags> DiscoveryEligibilityFlags { get; set; }
[JsonProperty("explicit_content_filter")]
public Optional<ApplicationExplicitContentFilterLevel> ExplicitContentFilter { get; set; }
[JsonProperty("hook")]
public bool IsHook { get; set; }
[JsonProperty("interactions_event_types")]
public Optional<string[]> InteractionsEventTypes { get; set; }
[JsonProperty("interactions_version")]
public Optional<ApplicationInteractionsVersion> InteractionsVersion { get; set; }
[JsonProperty("is_monetized")]
public bool IsMonetized { get; set; }
[JsonProperty("monetization_eligibility_flags")]
public Optional<ApplicationMonetizationEligibilityFlags> MonetizationEligibilityFlags { get; set; }
[JsonProperty("monetization_state")]
public Optional<ApplicationMonetizationState> MonetizationState { get; set; }
[JsonProperty("rpc_application_state")]
public Optional<ApplicationRpcState> RpcState { get; set; }
[JsonProperty("store_application_state")]
public Optional<ApplicationStoreState> StoreState { get; set; }
[JsonProperty("verification_state")]
public Optional<ApplicationVerificationState> VerificationState { get; set; }
}

View File

@@ -92,6 +92,9 @@ namespace Discord.API
[JsonProperty("max_stage_video_channel_users")]
public Optional<int> MaxStageVideoChannelUsers { get; set; }
[JsonProperty("inventory_settings")]
public Optional<GuildInventorySettings> InventorySettings { get; set; }
[JsonProperty("incidents_data")]
public GuildIncidentsData IncidentsData { get; set; }
}

View File

@@ -0,0 +1,9 @@
using Newtonsoft.Json;
namespace Discord.API;
internal class GuildInventorySettings
{
[JsonProperty("is_emoji_pack_collectible")]
public Optional<bool> IsEmojiPackCollectible { get; set; }
}

View File

@@ -457,7 +457,7 @@ namespace Discord.Rest
AvailableTags = props.Tags.GetValueOrDefault(Array.Empty<ForumTagProperties>()).Select(
x => new ModifyForumTagParams
{
Id = x.Id,
Id = x.Id ?? Optional<ulong>.Unspecified,
Name = x.Name,
EmojiId = x.Emoji is Emote emote
? emote.Id
@@ -1197,8 +1197,8 @@ namespace Discord.Rest
if (args.RegexPatterns.IsSpecified)
{
if (args.TriggerType.Value is not AutoModTriggerType.Keyword)
throw new ArgumentException(message: $"Regex patterns can only be used with 'Keyword' trigger type.", paramName: nameof(args.RegexPatterns));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Regex patterns can only be used with 'Keyword' or 'MemberProfile' trigger type.", paramName: nameof(args.RegexPatterns));
Preconditions.AtMost(args.RegexPatterns.Value.Length, AutoModRuleProperties.MaxRegexPatternCount, nameof(args.RegexPatterns), $"Regex pattern count must be less than or equal to {AutoModRuleProperties.MaxRegexPatternCount}.");
@@ -1208,8 +1208,8 @@ namespace Discord.Rest
if (args.KeywordFilter.IsSpecified)
{
if (args.TriggerType.Value != AutoModTriggerType.Keyword)
throw new ArgumentException(message: $"Keyword filter can only be used with 'Keyword' trigger type.", paramName: nameof(args.KeywordFilter));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Keyword filter can only be used with 'Keyword' or 'MemberProfile' trigger type.", paramName: nameof(args.KeywordFilter));
Preconditions.AtMost(args.KeywordFilter.Value.Length, AutoModRuleProperties.MaxKeywordCount, nameof(args.KeywordFilter), $"Keyword count must be less than or equal to {AutoModRuleProperties.MaxKeywordCount}");
@@ -1222,8 +1222,8 @@ namespace Discord.Rest
if (args.AllowList.IsSpecified)
{
if (args.TriggerType.Value is not AutoModTriggerType.Keyword or AutoModTriggerType.KeywordPreset)
throw new ArgumentException(message: $"Allow list can only be used with 'Keyword' or 'KeywordPreset' trigger type.", paramName: nameof(args.AllowList));
if (args.TriggerType.Value is not AutoModTriggerType.Keyword and not AutoModTriggerType.KeywordPreset and not AutoModTriggerType.MemberProfile)
throw new ArgumentException(message: $"Allow list can only be used with 'Keyword', 'KeywordPreset' or 'MemberProfile' trigger type.", paramName: nameof(args.AllowList));
if (args.TriggerType.Value is AutoModTriggerType.Keyword)
Preconditions.AtMost(args.AllowList.Value.Length, AutoModRuleProperties.MaxAllowListCountKeyword, nameof(args.AllowList), $"Allow list entry count must be less than or equal to {AutoModRuleProperties.MaxAllowListCountKeyword}.");
@@ -1258,7 +1258,7 @@ namespace Discord.Rest
if (args.ExemptChannels.IsSpecified)
Preconditions.AtMost(args.ExemptChannels.Value.Length, AutoModRuleProperties.MaxExemptChannels, nameof(args.ExemptChannels), $"Exempt channels count must be less than or equal to {AutoModRuleProperties.MaxExemptChannels}.");
if (!args.Actions.IsSpecified && args.Actions.Value.Length == 0)
if (!args.Actions.IsSpecified || args.Actions.Value.Length == 0)
{
throw new ArgumentException(message: $"At least 1 action must be set for an auto moderation rule.", paramName: nameof(args.Actions));
}

View File

@@ -118,6 +118,9 @@ namespace Discord.Rest
/// <inheritdoc/>
public GuildIncidentsData IncidentsData { get; private set; }
/// <inheritdoc />
public GuildInventorySettings? InventorySettings { get; private set; }
/// <inheritdoc />
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -204,6 +207,8 @@ namespace Discord.Rest
ApproximatePresenceCount = model.ApproximatePresenceCount.Value;
if (model.IsBoostProgressBarEnabled.IsSpecified)
IsBoostProgressBarEnabled = model.IsBoostProgressBarEnabled.Value;
if (model.InventorySettings.IsSpecified)
InventorySettings = model.InventorySettings.Value is null ? null : new (model.InventorySettings.Value.IsEmojiPackCollectible.GetValueOrDefault(false));
if (model.Emojis != null)
{

View File

@@ -64,6 +64,42 @@ namespace Discord.Rest
/// <inheritdoc />
public ApplicationInstallParams InstallParams { get; private set; }
/// <inheritdoc />
public ApplicationDiscoverabilityState DiscoverabilityState { get; private set; }
/// <inheritdoc />
public DiscoveryEligibilityFlags DiscoveryEligibilityFlags { get; private set; }
/// <inheritdoc />
public ApplicationExplicitContentFilterLevel ExplicitContentFilterLevel { get; private set; }
/// <inheritdoc />
public bool IsHook { get; private set; }
/// <inheritdoc />
public IReadOnlyCollection<string> InteractionEventTypes { get; private set; }
/// <inheritdoc />
public ApplicationInteractionsVersion InteractionsVersion { get; private set; }
/// <inheritdoc />
public bool IsMonetized { get; private set; }
/// <inheritdoc />
public ApplicationMonetizationEligibilityFlags MonetizationEligibilityFlags { get; private set; }
/// <inheritdoc />
public ApplicationMonetizationState MonetizationState { get; private set; }
/// <inheritdoc />
public ApplicationRpcState RpcState { get; private set; }
/// <inheritdoc />
public ApplicationStoreState StoreState { get; private set; }
/// <inheritdoc />
public ApplicationVerificationState VerificationState { get; private set; }
/// <inheritdoc />
public IReadOnlyCollection<string> Tags { get; private set; }
@@ -113,6 +149,22 @@ namespace Discord.Rest
RedirectUris = model.RedirectUris.Value.ToImmutableArray();
ApproximateGuildCount = model.ApproximateGuildCount.IsSpecified ? model.ApproximateGuildCount.Value : null;
DiscoverabilityState = model.DiscoverabilityState.GetValueOrDefault(ApplicationDiscoverabilityState.None);
DiscoveryEligibilityFlags = model.DiscoveryEligibilityFlags.GetValueOrDefault(DiscoveryEligibilityFlags.None);
ExplicitContentFilterLevel = model.ExplicitContentFilter.GetValueOrDefault(ApplicationExplicitContentFilterLevel.Disabled);
IsHook = model.IsHook;
InteractionEventTypes = model.InteractionsEventTypes.GetValueOrDefault(Array.Empty<string>()).ToImmutableArray();
InteractionsVersion = model.InteractionsVersion.GetValueOrDefault(ApplicationInteractionsVersion.Version1);
IsMonetized = model.IsMonetized;
MonetizationEligibilityFlags = model.MonetizationEligibilityFlags.GetValueOrDefault(ApplicationMonetizationEligibilityFlags.None);
MonetizationState = model.MonetizationState.GetValueOrDefault(ApplicationMonetizationState.None);
RpcState = model.RpcState.GetValueOrDefault(ApplicationRpcState.Disabled);
StoreState = model.StoreState.GetValueOrDefault(ApplicationStoreState.None);
VerificationState = model.VerificationState.GetValueOrDefault(ApplicationVerificationState.Ineligible);
}
/// <exception cref="InvalidOperationException">Unable to update this object from a different application token.</exception>

View File

@@ -146,6 +146,9 @@ namespace Discord.WebSocket
/// <inheritdoc/>
public GuildIncidentsData IncidentsData { get; private set; }
/// <inheritdoc />
public GuildInventorySettings? InventorySettings { get; private set; }
/// <inheritdoc />
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
/// <inheritdoc />
@@ -571,6 +574,9 @@ namespace Discord.WebSocket
PreferredCulture = PreferredLocale == null ? null : new CultureInfo(PreferredLocale);
if (model.IsBoostProgressBarEnabled.IsSpecified)
IsBoostProgressBarEnabled = model.IsBoostProgressBarEnabled.Value;
if (model.InventorySettings.IsSpecified)
InventorySettings = model.InventorySettings.Value is null ? null : new(model.InventorySettings.Value.IsEmojiPackCollectible.GetValueOrDefault(false));
IncidentsData = model.IncidentsData is not null
? new GuildIncidentsData { DmsDisabledUntil = model.IncidentsData.DmsDisabledUntil, InvitesDisabledUntil = model.IncidentsData.InvitesDisabledUntil }
: new GuildIncidentsData();