diff --git a/src/Discord.Net.Core/DiscordConfig.cs b/src/Discord.Net.Core/DiscordConfig.cs
index 46fc08ff95..6957c02f47 100644
--- a/src/Discord.Net.Core/DiscordConfig.cs
+++ b/src/Discord.Net.Core/DiscordConfig.cs
@@ -232,5 +232,10 @@ public class DiscordConfig
/// Returns the max length of an application description.
///
public const int MaxApplicationDescriptionLength = 400;
+
+ ///
+ /// Returns the max amount of tags applied to an application.
+ ///
+ public const int MaxApplicationTagCount = 5;
}
}
diff --git a/src/Discord.Net.Core/Entities/Applications/ApplicationFlags.cs b/src/Discord.Net.Core/Entities/Applications/ApplicationFlags.cs
index 0c6cfe7e3c..b11467ce6f 100644
--- a/src/Discord.Net.Core/Entities/Applications/ApplicationFlags.cs
+++ b/src/Discord.Net.Core/Entities/Applications/ApplicationFlags.cs
@@ -9,28 +9,62 @@ namespace Discord;
///
/// Represents public flags for an application.
///
+[Flags]
public enum ApplicationFlags
{
+ ///
+ /// Indicates if an app uses the Auto Moderation API.
+ ///
UsesAutoModApi = 1 << 6,
+ ///
+ /// Indicates that the app has been verified to use GUILD_PRESENCES intent.
+ ///
GatewayPresence = 1 << 12,
+ ///
+ /// Indicates that the app has enabled the GUILD_PRESENCES intent on a bot in less than 100 servers.
+ ///
GatewayPresenceLimited = 1 << 13,
+ ///
+ /// Indicates that the app has been verified to use GUILD_MEMBERS intent.
+ ///
GatewayGuildMembers = 1 << 14,
+ ///
+ /// Indicates that the app has enabled the GUILD_MEMBERS intent on a bot in less than 100 servers.
+ ///
GatewayGuildMembersLimited = 1 << 15,
+ ///
+ /// Indicates unusual growth of an app that prevents verification.
+ ///
VerificationPendingGuildLimit = 1 << 16,
+ ///
+ /// Indicates if an app is embedded within the Discord client.
+ ///
Embedded = 1 << 17,
+ ///
+ /// Indicates that the app has been verified to use MESSAGE_CONTENT intent.
+ ///
GatewayMessageContent = 1 << 18,
+ ///
+ /// Indicates that the app has enabled the MESSAGE_CONTENT intent on a bot in less than 100 servers.
+ ///
GatewayMessageContentLimited = 1 << 19,
+ ///
+ /// Indicates if an app has registered global application commands.
+ ///
ApplicationCommandBadge = 1 << 23,
+ ///
+ /// Indicates if an app is considered active.
+ ///
ActiveApplication = 1 << 24
}
diff --git a/src/Discord.Net.Core/Entities/Applications/ApplicationInstallParams.cs b/src/Discord.Net.Core/Entities/Applications/ApplicationInstallParams.cs
index 180592f1ec..672cb8ec0b 100644
--- a/src/Discord.Net.Core/Entities/Applications/ApplicationInstallParams.cs
+++ b/src/Discord.Net.Core/Entities/Applications/ApplicationInstallParams.cs
@@ -1,31 +1,31 @@
-using System;
using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-namespace Discord
+namespace Discord;
+
+///
+/// Represents install parameters for an application.
+///
+public class ApplicationInstallParams
{
///
- /// Represents install parameters for an application.
+ /// Gets the scopes to install this application.
///
- public class ApplicationInstallParams
+ public IReadOnlyCollection Scopes { get; }
+
+ ///
+ /// Gets the default permissions to install this application.
+ ///
+ public GuildPermission Permission { get; }
+
+ public ApplicationInstallParams(string[] scopes, GuildPermission permission)
{
- ///
- /// Gets the scopes to install this application.
- ///
- public IReadOnlyCollection Scopes { get; }
+ Preconditions.NotNull(scopes, nameof(scopes));
- ///
- /// Gets the default permissions to install this application
- ///
- public GuildPermission? Permission { get; }
+ foreach (var s in scopes)
+ Preconditions.NotNull(s, nameof(scopes));
- internal ApplicationInstallParams(string[] scopes, GuildPermission? permission)
- {
- Scopes = scopes.ToImmutableArray();
- Permission = permission;
- }
+ Scopes = scopes.ToImmutableArray();
+ Permission = permission;
}
}
diff --git a/src/Discord.Net.Core/Entities/Applications/IApplication.cs b/src/Discord.Net.Core/Entities/Applications/IApplication.cs
index 5e2aaf0de7..c9a31f9c91 100644
--- a/src/Discord.Net.Core/Entities/Applications/IApplication.cs
+++ b/src/Discord.Net.Core/Entities/Applications/IApplication.cs
@@ -24,7 +24,7 @@ public interface IApplication : ISnowflakeEntity
///
ApplicationFlags Flags { get; }
///
- /// Gets a collection of install parameters for this application.
+ /// Gets a collection of install parameters for this application; if disabled.
///
ApplicationInstallParams InstallParams { get; }
///
diff --git a/src/Discord.Net.Core/Entities/Applications/ModifyApplicationProperties.cs b/src/Discord.Net.Core/Entities/Applications/ModifyApplicationProperties.cs
index be6fdef057..2306752c85 100644
--- a/src/Discord.Net.Core/Entities/Applications/ModifyApplicationProperties.cs
+++ b/src/Discord.Net.Core/Entities/Applications/ModifyApplicationProperties.cs
@@ -29,4 +29,29 @@ public class ModifyApplicationProperties
/// Gets or sets the icon of the application.
///
public Optional Icon { get; set; }
+
+ ///
+ /// Gets or sets the default rich presence invite cover image of the application.
+ ///
+ public Optional CoverImage { get; set; }
+
+ ///
+ /// Gets or set the default custom authorization URL for the app, if enabled.
+ ///
+ public Optional CustomInstallUrl { get; set; }
+
+ ///
+ /// Gets or sets settings for the app's default in-app authorization link, if enabled.
+ ///
+ public Optional InstallParams { get; set; }
+
+ ///
+ /// Gets or sets app's public flags.
+ ///
+ ///
+ /// Only , and
+ /// flags can be updated.
+ ///
+ public Optional Flags { get; set; }
+
}
diff --git a/src/Discord.Net.Rest/API/Common/InstallParams.cs b/src/Discord.Net.Rest/API/Common/InstallParams.cs
index 1fb987f30e..d610dd9200 100644
--- a/src/Discord.Net.Rest/API/Common/InstallParams.cs
+++ b/src/Discord.Net.Rest/API/Common/InstallParams.cs
@@ -1,17 +1,12 @@
using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-namespace Discord.API
+namespace Discord.API;
+
+internal class InstallParams
{
- internal class InstallParams
- {
- [JsonProperty("scopes")]
- public string[] Scopes { get; set; }
- [JsonProperty("permissions")]
- public ulong Permission { get; set; }
- }
+ [JsonProperty("scopes")]
+ public string[] Scopes { get; set; }
+
+ [JsonProperty("permissions")]
+ public ulong Permission { get; set; }
}
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyCurrentApplicationBotParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyCurrentApplicationBotParams.cs
index fdd665b233..3284827fc0 100644
--- a/src/Discord.Net.Rest/API/Rest/ModifyCurrentApplicationBotParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/ModifyCurrentApplicationBotParams.cs
@@ -4,18 +4,30 @@ namespace Discord.API.Rest;
internal class ModifyCurrentApplicationBotParams
{
- [JsonProperty("interactions_endpoint_url")]
- public Optional InteractionsEndpointUrl { get; set; }
+ [JsonProperty("custom_install_url")]
+ public Optional CustomInstallUrl { get; set; }
+
+ [JsonProperty("description")]
+ public Optional Description { get; set; }
[JsonProperty("role_connections_verification_url")]
public Optional RoleConnectionsEndpointUrl { get; set; }
- [JsonProperty("description")]
- public Optional Description { get; set; }
+ [JsonProperty("install_params")]
+ public Optional InstallParams { get; set; }
- [JsonProperty("tags")]
- public Optional Tags { get; set; }
+ [JsonProperty("flags")]
+ public Optional Flags { get; set; }
[JsonProperty("icon")]
public Optional Icon { get; set; }
+
+ [JsonProperty("cover_image")]
+ public Optional CoverImage { get; set; }
+
+ [JsonProperty("interactions_endpoint_url")]
+ public Optional InteractionsEndpointUrl { get; set; }
+
+ [JsonProperty("tags")]
+ public Optional Tags { get; set; }
}
diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs
index 1d95c2c17c..1fb7b38e91 100644
--- a/src/Discord.Net.Rest/ClientHelper.cs
+++ b/src/Discord.Net.Rest/ClientHelper.cs
@@ -1,4 +1,6 @@
+using Discord.API;
using Discord.API.Rest;
+
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -28,11 +30,14 @@ public static async Task GetCurrentBotApplicationAsync(BaseDisc
var args = new ModifyApplicationProperties();
func(args);
- if(args.Tags.IsSpecified)
+ if (args.Tags.IsSpecified)
+ {
+ Preconditions.AtMost(args.Tags.Value.Length, DiscordConfig.MaxApplicationTagCount, nameof(args.Tags), $"An application can have a maximum of {DiscordConfig.MaxApplicationTagCount} applied.");
foreach (var tag in args.Tags.Value)
Preconditions.AtMost(tag.Length, DiscordConfig.MaxApplicationTagLength, nameof(args.Tags), $"An application tag must have length less or equal to {DiscordConfig.MaxApplicationTagLength}");
+ }
- if(args.Description.IsSpecified)
+ if (args.Description.IsSpecified)
Preconditions.AtMost(args.Description.Value.Length, DiscordConfig.MaxApplicationDescriptionLength, nameof(args.Description), $"An application description tag mus have length less or equal to {DiscordConfig.MaxApplicationDescriptionLength}");
return await client.ApiClient.ModifyCurrentBotApplicationAsync(new()
@@ -42,6 +47,18 @@ public static async Task GetCurrentBotApplicationAsync(BaseDisc
Icon = args.Icon.IsSpecified ? args.Icon.Value?.ToModel() : Optional.Unspecified,
InteractionsEndpointUrl = args.InteractionsEndpointUrl,
RoleConnectionsEndpointUrl = args.RoleConnectionsEndpointUrl,
+ Flags = args.Flags,
+ CoverImage = args.CoverImage.IsSpecified ? args.CoverImage.Value?.ToModel() : Optional.Unspecified,
+ CustomInstallUrl = args.CustomInstallUrl,
+ InstallParams = args.InstallParams.IsSpecified
+ ? args.InstallParams.Value is null
+ ? null
+ : new InstallParams
+ {
+ Permission = (ulong)args.InstallParams.Value.Permission,
+ Scopes = args.InstallParams.Value.Scopes.ToArray()
+ }
+ : Optional.Unspecified,
}, options);
}
diff --git a/src/Discord.Net.Rest/Entities/RestApplication.cs b/src/Discord.Net.Rest/Entities/RestApplication.cs
index 4b50fafd2f..b35322f992 100644
--- a/src/Discord.Net.Rest/Entities/RestApplication.cs
+++ b/src/Discord.Net.Rest/Entities/RestApplication.cs
@@ -61,8 +61,10 @@ public class RestApplication : RestEntity, IApplication
///
public string InteractionsEndpointUrl { get; private set; }
+ ///
public ApplicationInstallParams InstallParams { get; private set; }
+ ///
public IReadOnlyCollection Tags { get; private set; }
internal RestApplication(BaseDiscordClient discord, ulong id)
@@ -86,8 +88,10 @@ internal void Update(Model model)
Tags = model.Tags.GetValueOrDefault(null)?.ToImmutableArray() ?? ImmutableArray.Empty;
PrivacyPolicy = model.PrivacyPolicy;
TermsOfService = model.TermsOfService;
- var installParams = model.InstallParams.GetValueOrDefault(null);
- InstallParams = new ApplicationInstallParams(installParams?.Scopes ?? Array.Empty(), (GuildPermission?)installParams?.Permission);
+
+ InstallParams = model.InstallParams.IsSpecified
+ ? new ApplicationInstallParams(model.InstallParams.Value.Scopes, (GuildPermission)model.InstallParams.Value.Permission)
+ : null;
if (model.Flags.IsSpecified)
Flags = model.Flags.Value;