-
Notifications
You must be signed in to change notification settings - Fork 47
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 #327 from VelvetToroyashi/feat/user-apps
Add support for user-installable applications
- Loading branch information
Showing
46 changed files
with
894 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
...nd/Remora.Discord.API.Abstractions/API/Objects/Applications/ApplicationIntegrationType.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// ApplicationIntegrationType.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents valid locations for users to install application integrations. | ||
/// </summary> | ||
[PublicAPI] | ||
public enum ApplicationIntegrationType | ||
{ | ||
/// <summary> | ||
/// Specifies that the integration can be installed on a guild. | ||
/// </summary> | ||
GuildInstallable = 0, | ||
|
||
/// <summary> | ||
/// Specifies that the integration can be installed on a user. | ||
/// </summary> | ||
UserInstallable = 1, | ||
} |
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
37 changes: 37 additions & 0 deletions
37
...ra.Discord.API.Abstractions/API/Objects/Applications/IApplicationIntegrationTypeConfig.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// IApplicationIntegrationTypeConfig.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// The integration type configuration for an application. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IApplicationIntegrationTypeConfig | ||
{ | ||
/// <summary> | ||
/// Gets the OAuth2 install parameters for the integration type. | ||
/// </summary> | ||
public IApplicationOAuth2InstallParams OAuth2InstallParams { get; } | ||
} |
46 changes: 46 additions & 0 deletions
46
...mora.Discord.API.Abstractions/API/Objects/Applications/IApplicationOAuth2InstallParams.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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// IApplicationOAuth2InstallParams.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents the OAuth2 install parameters for an application. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IApplicationOAuth2InstallParams | ||
{ | ||
/// <summary> | ||
/// Gets the permissions required for the application. | ||
/// </summary> | ||
/// <remarks> | ||
/// Only applicable if <see cref="IApplicationOAuth2InstallParams.Scopes"/> includes `bot`. | ||
/// </remarks> | ||
IDiscordPermissionSet Permissions { get; } | ||
|
||
/// <summary> | ||
/// Gets the list of OAuth2 scopes required for the application. | ||
/// </summary> | ||
IReadOnlyList<string> Scopes { get; } | ||
} |
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
37 changes: 37 additions & 0 deletions
37
...scord.API.Abstractions/API/Objects/Interactions/IApplicationCommandInteractionMetadata.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// IApplicationCommandInteractionMetadata.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents metadata related to application commands. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IApplicationCommandInteractionMetadata : IMessageInteractionMetadata | ||
{ | ||
/// <summary> | ||
/// Gets the name of the command. | ||
/// </summary> | ||
string Name { get; } | ||
} |
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
38 changes: 38 additions & 0 deletions
38
...Discord.API.Abstractions/API/Objects/Interactions/IMessageComponentInteractionMetadata.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// IMessageComponentInteractionMetadata.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using JetBrains.Annotations; | ||
using Remora.Rest.Core; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents metadata related to a message component interaction. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IMessageComponentInteractionMetadata : IMessageInteractionMetadata | ||
{ | ||
/// <summary> | ||
/// Gets the ID of the message that was interacted with. | ||
/// </summary> | ||
Snowflake InteractedMessageID { get; } | ||
} |
68 changes: 68 additions & 0 deletions
68
...d/Remora.Discord.API.Abstractions/API/Objects/Interactions/IMessageInteractionMetadata.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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// IMessageInteractionMetadata.cs | ||
// | ||
// Author: | ||
// Jarl Gullberg <[email protected]> | ||
// | ||
// Copyright (c) Jarl Gullberg | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
using System.Collections.Generic; | ||
using JetBrains.Annotations; | ||
using Remora.Rest.Core; | ||
|
||
namespace Remora.Discord.API.Abstractions.Objects; | ||
|
||
/// <summary> | ||
/// Represents the metadata of an application command interaction. | ||
/// </summary> | ||
[PublicAPI] | ||
public interface IMessageInteractionMetadata | ||
{ | ||
/// <summary> | ||
/// Gets the ID of the interaction. | ||
/// </summary> | ||
Snowflake ID { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the user who triggered the interaction. | ||
/// </summary> | ||
Snowflake UserID { get; } | ||
|
||
/// <summary> | ||
/// Gets the type of the interaction. | ||
/// </summary> | ||
InteractionType Type { get; } | ||
|
||
/// <summary> | ||
/// Gets the ID of the original response message. Only applicable to followup messages. | ||
/// </summary> | ||
Optional<Snowflake> OriginalResponseMessageID { get; } | ||
|
||
/// <summary> | ||
/// Gets the integrations that authorized the interaction. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is a mapping of the integration type to the ID of its resource. | ||
/// <para> | ||
/// The dictionary contains the following, given the circumstances: <br/> | ||
/// - If the integration is installed to a user, a key of <see cref="ApplicationIntegrationType.UserInstallable"/> and the value is the user ID. <br/> | ||
/// - If the integration is installed to a guild, a key of <see cref="ApplicationIntegrationType.GuildInstallable"/> and the value is the guild ID. | ||
/// If the interaction is sent outside the context of a guild, the value is always zero.<br/> | ||
/// </para> | ||
/// </remarks> | ||
IReadOnlyDictionary<ApplicationIntegrationType, Snowflake> AuthorizingIntegrationOwners { get; } | ||
} |
Oops, something went wrong.