forked from discord-net/Discord.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Panthr75/update-modify-current-application
[Feature] New `ModifyCurrentApplication` features
- Loading branch information
Showing
9 changed files
with
128 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 34 additions & 5 deletions
39
src/Discord.Net.Core/Entities/Applications/ApplicationFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents public flags for an application. | ||
/// </summary> | ||
[Flags] | ||
public enum ApplicationFlags | ||
{ | ||
/// <summary> | ||
/// Indicates if an app uses the Auto Moderation API. | ||
/// </summary> | ||
UsesAutoModApi = 1 << 6, | ||
|
||
/// <summary> | ||
/// Indicates that the app has been verified to use GUILD_PRESENCES intent. | ||
/// </summary> | ||
GatewayPresence = 1 << 12, | ||
|
||
/// <summary> | ||
/// Indicates that the app has enabled the GUILD_PRESENCES intent on a bot in less than 100 servers. | ||
/// </summary> | ||
GatewayPresenceLimited = 1 << 13, | ||
|
||
/// <summary> | ||
/// Indicates that the app has been verified to use GUILD_MEMBERS intent. | ||
/// </summary> | ||
GatewayGuildMembers = 1 << 14, | ||
|
||
/// <summary> | ||
/// Indicates that the app has enabled the GUILD_MEMBERS intent on a bot in less than 100 servers. | ||
/// </summary> | ||
GatewayGuildMembersLimited = 1 << 15, | ||
|
||
/// <summary> | ||
/// Indicates unusual growth of an app that prevents verification. | ||
/// </summary> | ||
VerificationPendingGuildLimit = 1 << 16, | ||
|
||
/// <summary> | ||
/// Indicates if an app is embedded within the Discord client. | ||
/// </summary> | ||
Embedded = 1 << 17, | ||
|
||
/// <summary> | ||
/// Indicates that the app has been verified to use MESSAGE_CONTENT intent. | ||
/// </summary> | ||
GatewayMessageContent = 1 << 18, | ||
|
||
/// <summary> | ||
/// Indicates that the app has enabled the MESSAGE_CONTENT intent on a bot in less than 100 servers. | ||
/// </summary> | ||
GatewayMessageContentLimited = 1 << 19, | ||
|
||
/// <summary> | ||
/// Indicates if an app has registered global application commands. | ||
/// </summary> | ||
ApplicationCommandBadge = 1 << 23, | ||
|
||
/// <summary> | ||
/// Indicates if an app is considered active. | ||
/// </summary> | ||
ActiveApplication = 1 << 24 | ||
} | ||
|
39 changes: 20 additions & 19 deletions
39
src/Discord.Net.Core/Entities/Applications/ApplicationInstallParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord | ||
namespace Discord; | ||
|
||
/// <summary> | ||
/// Represents install parameters for an application. | ||
/// </summary> | ||
public class ApplicationInstallParams | ||
{ | ||
/// <summary> | ||
/// Represents install parameters for an application. | ||
/// Gets the scopes to install this application. | ||
/// </summary> | ||
public class ApplicationInstallParams | ||
{ | ||
/// <summary> | ||
/// Gets the scopes to install this application. | ||
/// </summary> | ||
public IReadOnlyCollection<string> Scopes { get; } | ||
public IReadOnlyCollection<string> Scopes { get; } | ||
|
||
/// <summary> | ||
/// Gets the default permissions to install this application | ||
/// </summary> | ||
public GuildPermission? Permission { get; } | ||
/// <summary> | ||
/// Gets the default permissions to install this application | ||
/// </summary> | ||
public GuildPermission Permission { get; } | ||
|
||
internal ApplicationInstallParams(string[] scopes, GuildPermission? permission) | ||
public ApplicationInstallParams(string[] scopes, GuildPermission permission) | ||
{ | ||
Preconditions.NotNull(scopes, nameof(scopes)); | ||
foreach (var scope in scopes) | ||
{ | ||
Scopes = scopes.ToImmutableArray(); | ||
Permission = permission; | ||
Preconditions.NotNullOrEmpty(scope, nameof(scope)); | ||
} | ||
Scopes = scopes.ToImmutableArray(); | ||
Permission = permission; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
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 | ||
{ | ||
[JsonPropertyName("scopes")] | ||
public string[] Scopes { get; set; } = Array.Empty<string>(); | ||
[JsonPropertyName("permissions")] | ||
public ulong Permission { get; set; } | ||
} | ||
[JsonPropertyName("scopes")] | ||
public string[] Scopes { get; set; } = Array.Empty<string>(); | ||
[JsonPropertyName("permissions")] | ||
public ulong Permission { get; set; } | ||
} |
25 changes: 18 additions & 7 deletions
25
src/Discord.Net.Rest/API/Rest/ModifyCurrentApplicationBotParams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Discord.API.Rest; | ||
|
||
internal class ModifyCurrentApplicationBotParams | ||
{ | ||
[JsonPropertyName("interactions_endpoint_url")] | ||
public Optional<string> InteractionsEndpointUrl { get; set; } | ||
[JsonPropertyName("custom_install_url")] | ||
public Optional<string> CustomInstallUrl { get; set; } | ||
|
||
[JsonPropertyName("description")] | ||
public Optional<string> Description { get; set; } | ||
|
||
[JsonPropertyName("role_connections_verification_url")] | ||
public Optional<string> RoleConnectionsEndpointUrl { get; set; } | ||
|
||
[JsonPropertyName("description")] | ||
public Optional<string> Description { get; set; } | ||
[JsonPropertyName("install_params")] | ||
public Optional<InstallParams> InstallParams { get; set; } | ||
|
||
[JsonPropertyName("tags")] | ||
public Optional<string[]> Tags { get; set; } | ||
[JsonPropertyName("flags")] | ||
public Optional<ApplicationFlags> Flags { get; set; } | ||
|
||
[JsonPropertyName("icon")] | ||
public Optional<Image?> Icon { get; set; } | ||
|
||
[JsonPropertyName("cover_image")] | ||
public Optional<Image?> CoverImage { get; set; } | ||
|
||
[JsonPropertyName("interactions_endpoint_url")] | ||
public Optional<string> InteractionsEndpointUrl { get; set; } | ||
|
||
[JsonPropertyName("tags")] | ||
public Optional<string[]> Tags { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters