Browse Source

Merge branch 'release/3.x' of https://github.com/Discord-Net-Labs/Discord.Net-Labs into release/3.x

pull/1923/head
quin lynch 3 years ago
parent
commit
c0c253e206
27 changed files with 246 additions and 24 deletions
  1. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/IMessageCommandInteraction.cs
  2. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/IMessageCommandInteractionData.cs
  3. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/IUserCommandInteraction.cs
  4. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/ContextMenus/IUserCommandInteractionData.cs
  5. +18
    -0
      src/Discord.Net.Core/Entities/Interactions/MessageComponents/IComponentInteraction.cs
  6. +25
    -0
      src/Discord.Net.Core/Entities/Interactions/MessageComponents/IComponentInteractionData.cs
  7. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/SlashCommands/IAutocompleteInteraction.cs
  8. +40
    -0
      src/Discord.Net.Core/Entities/Interactions/SlashCommands/IAutocompleteInteractionData.cs
  9. +13
    -0
      src/Discord.Net.Core/Entities/Interactions/SlashCommands/ISlashCommandInteraction.cs
  10. +4
    -2
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs
  11. +5
    -1
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs
  12. +4
    -2
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommand.cs
  13. +5
    -1
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs
  14. +7
    -2
      src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponent.cs
  15. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs
  16. +4
    -3
      src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteraction.cs
  17. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs
  18. +4
    -2
      src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestSlashCommand.cs
  19. +7
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs
  20. +5
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommandData.cs
  21. +7
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/UserCommands/SocketUserCommand.cs
  22. +5
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/UserCommands/SocketUserCommandData.cs
  23. +10
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs
  24. +1
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponentData.cs
  25. +7
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs
  26. +1
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs
  27. +7
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/ContextMenus/IMessageCommandInteraction.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents a Message Command interaction.
/// </summary>
public interface IMessageCommandInteraction : IDiscordInteraction
{
/// <summary>
/// Gets the data associated with this interaction.
/// </summary>
new IMessageCommandInteractionData Data { get; }
}
}

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/ContextMenus/IMessageCommandInteractionData.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents the data tied with the <see cref="IMessageCommandInteraction"/> interaction.
/// </summary>
public interface IMessageCommandInteractionData : IApplicationCommandInteractionData
{
/// <summary>
/// Gets the message associated with this message command.
/// </summary>
IMessage Message { get; }
}
}

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/ContextMenus/IUserCommandInteraction.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents a User Command interaction.
/// </summary>
public interface IUserCommandInteraction : IDiscordInteraction
{
/// <summary>
/// Gets the data associated with this interaction.
/// </summary>
new IUserCommandInteractionData Data { get; }
}
}

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/ContextMenus/IUserCommandInteractionData.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents the data tied with the <see cref="IUserCommandInteraction"/> interaction.
/// </summary>
public interface IUserCommandInteractionData : IApplicationCommandInteractionData
{
/// <summary>
/// Gets the user who this command targets.
/// </summary>
IUser User { get; }
}
}

+ 18
- 0
src/Discord.Net.Core/Entities/Interactions/MessageComponents/IComponentInteraction.cs View File

@@ -0,0 +1,18 @@
namespace Discord
{
/// <summary>
/// Represents an interaction type for Message Components.
/// </summary>
public interface IComponentInteraction : IDiscordInteraction
{
/// <summary>
/// Gets the data received with this interaction, contains the button that was clicked.
/// </summary>
new IComponentInteractionData Data { get; }

/// <summary>
/// Gets the message that contained the trigger for this interaction.
/// </summary>
IUserMessage Message { get; }
}
}

+ 25
- 0
src/Discord.Net.Core/Entities/Interactions/MessageComponents/IComponentInteractionData.cs View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;

namespace Discord
{
/// <summary>
/// Represents the data sent with the <see cref="IComponentInteraction"/>.
/// </summary>
public interface IComponentInteractionData : IDiscordInteractionData
{
/// <summary>
/// Gets the components Custom Id that was clicked.
/// </summary>
string CustomId { get; }

/// <summary>
/// Gets the type of the component clicked.
/// </summary>
ComponentType Type { get; }

/// <summary>
/// Gets the value(s) of a <see cref="SelectMenuComponent"/> interaction response.
/// </summary>
IReadOnlyCollection<string> Values { get; }
}
}

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/SlashCommands/IAutocompleteInteraction.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents a <see cref="InteractionType.ApplicationCommandAutocomplete"/>.
/// </summary>
public interface IAutocompleteInteraction : IDiscordInteraction
{
/// <summary>
/// Gets the autocomplete data of this interaction.
/// </summary>
new IAutocompleteInteractionData Data { get; }
}
}

+ 40
- 0
src/Discord.Net.Core/Entities/Interactions/SlashCommands/IAutocompleteInteractionData.cs View File

@@ -0,0 +1,40 @@
using System.Collections.Generic;

namespace Discord
{
/// <summary>
/// Represents data for a slash commands autocomplete interaction.
/// </summary>
public interface IAutocompleteInteractionData : IDiscordInteractionData
{
/// <summary>
/// Gets the name of the invoked command.
/// </summary>
string CommandName { get; }

/// <summary>
/// Gets the id of the invoked command.
/// </summary>
ulong CommandId { get; }

/// <summary>
/// Gets the type of the invoked command.
/// </summary>
ApplicationCommandType Type { get; }

/// <summary>
/// Gets the version of the invoked command.
/// </summary>
ulong Version { get; }

/// <summary>
/// Gets the current autocomplete option that is actively being filled out.
/// </summary>
AutocompleteOption Current { get; }

/// <summary>
/// Gets a collection of all the other options the executing users has filled out.
/// </summary>
IReadOnlyCollection<AutocompleteOption> Options { get; }
}
}

+ 13
- 0
src/Discord.Net.Core/Entities/Interactions/SlashCommands/ISlashCommandInteraction.cs View File

@@ -0,0 +1,13 @@
namespace Discord
{
/// <summary>
/// Represents a slash command interaction.
/// </summary>
public interface ISlashCommandInteraction : IDiscordInteraction
{
/// <summary>
/// Gets the data associated with this interaction.
/// </summary>
new IApplicationCommandInteractionData Data { get; }
}
}

+ 4
- 2
src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs View File

@@ -7,7 +7,7 @@ namespace Discord.Rest
/// <summary>
/// Represents a REST-based message command interaction.
/// </summary>
public class RestMessageCommand : RestCommandBase, IDiscordInteraction
public class RestMessageCommand : RestCommandBase, IMessageCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
@@ -38,6 +38,8 @@ namespace Discord.Rest
Data = await RestMessageCommandData.CreateAsync(client, dataModel, Guild, Channel).ConfigureAwait(false);
}

IDiscordInteractionData IDiscordInteraction.Data => Data;
//IMessageCommandInteraction
/// <inheritdoc/>
IMessageCommandInteractionData IMessageCommandInteraction.Data => Data;
}
}

+ 5
- 1
src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs View File

@@ -10,7 +10,7 @@ namespace Discord.Rest
/// <summary>
/// Represents the data for a <see cref="RestMessageCommand"/>.
/// </summary>
public class RestMessageCommandData : RestCommandBaseData, IDiscordInteractionData
public class RestMessageCommandData : RestCommandBaseData, IMessageCommandInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the message associated with this message command.
@@ -34,5 +34,9 @@ namespace Discord.Rest
await entity.UpdateAsync(client, model, guild, channel).ConfigureAwait(false);
return entity;
}

//IMessageCommandInteractionData
/// <inheritdoc/>
IMessage IMessageCommandInteractionData.Message => Message;
}
}

+ 4
- 2
src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommand.cs View File

@@ -11,7 +11,7 @@ namespace Discord.Rest
/// <summary>
/// Represents a REST-based user command.
/// </summary>
internal class RestUserCommand : RestCommandBase, IDiscordInteraction
internal class RestUserCommand : RestCommandBase, IUserCommandInteraction, IDiscordInteraction
{
/// <summary>
/// Gets the data associated with this interaction.
@@ -41,6 +41,8 @@ namespace Discord.Rest
Data = await RestUserCommandData.CreateAsync(client, dataModel, Guild, Channel).ConfigureAwait(false);
}

IDiscordInteractionData IDiscordInteraction.Data => Data;
//IUserCommandInteractionData
/// <inheritdoc/>
IUserCommandInteractionData IUserCommandInteraction.Data => Data;
}
}

+ 5
- 1
src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs View File

@@ -8,7 +8,7 @@ namespace Discord.Rest
/// <summary>
/// Represents the data for a <see cref="RestUserCommand"/>.
/// </summary>
public class RestUserCommandData : RestCommandBaseData, IDiscordInteractionData
public class RestUserCommandData : RestCommandBaseData, IUserCommandInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the user who this command targets.
@@ -32,5 +32,9 @@ namespace Discord.Rest
await entity.UpdateAsync(client, model, guild, channel).ConfigureAwait(false);
return entity;
}

//IUserCommandInteractionData
/// <inheritdoc/>
IUser IUserCommandInteractionData.User => Member;
}
}

+ 7
- 2
src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponent.cs View File

@@ -13,7 +13,7 @@ namespace Discord.Rest
/// <summary>
/// Represents a REST-based message component.
/// </summary>
internal class RestMessageComponent : RestInteraction, IDiscordInteraction
internal class RestMessageComponent : RestInteraction, IComponentInteraction, IDiscordInteraction
{
/// <summary>
/// Gets the data received with this interaction, contains the button that was clicked.
@@ -442,6 +442,11 @@ namespace Discord.Rest
return SerializePayload(response);
}

IDiscordInteractionData IDiscordInteraction.Data => Data;
//IComponentInteraction
/// <inheritdoc/>
IComponentInteractionData IComponentInteraction.Data => Data;

/// <inheritdoc/>
IUserMessage IComponentInteraction.Message => Message;
}
}

+ 1
- 1
src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs View File

@@ -10,7 +10,7 @@ namespace Discord.Rest
/// <summary>
/// Represents data for a <see cref="RestMessageComponent"/>.
/// </summary>
public class RestMessageComponentData : IDiscordInteractionData
public class RestMessageComponentData : IComponentInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the components Custom Id that was clicked.


+ 4
- 3
src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteraction.cs View File

@@ -12,7 +12,7 @@ namespace Discord.Rest
/// <summary>
/// Represents a REST-based autocomplete interaction.
/// </summary>
public class RestAutocompleteInteraction : RestInteraction, IDiscordInteraction
public class RestAutocompleteInteraction : RestInteraction, IAutocompleteInteraction, IDiscordInteraction
{
/// <summary>
/// Gets the autocomplete data of this interaction.
@@ -128,7 +128,8 @@ namespace Discord.Rest
public override string Respond(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
=> throw new NotSupportedException("Autocomplete interactions cannot be deferred!");

IDiscordInteractionData IDiscordInteraction.Data => Data;

//IAutocompleteInteraction
/// <inheritdoc/>
IAutocompleteInteractionData IAutocompleteInteraction.Data => Data;
}
}

+ 1
- 1
src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs View File

@@ -11,7 +11,7 @@ namespace Discord.Rest
/// <summary>
/// Represents the data for a <see cref="RestAutocompleteInteraction"/>.
/// </summary>
public class RestAutocompleteInteractionData : IDiscordInteractionData
public class RestAutocompleteInteractionData : IAutocompleteInteractionData
{
/// <summary>
/// Gets the name of the invoked command.


+ 4
- 2
src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestSlashCommand.cs View File

@@ -11,7 +11,7 @@ namespace Discord.Rest
/// <summary>
/// Represents a REST-based slash command.
/// </summary>
public class RestSlashCommand : RestCommandBase, IDiscordInteraction
public class RestSlashCommand : RestCommandBase, ISlashCommandInteraction, IDiscordInteraction
{
/// <summary>
/// Gets the data associated with this interaction.
@@ -39,6 +39,8 @@ namespace Discord.Rest
Data = await RestSlashCommandData.CreateAsync(client, dataModel, Guild, Channel);
}

IDiscordInteractionData IDiscordInteraction.Data => Data;
//ISlashCommandInteraction
/// <inheritdoc/>
IApplicationCommandInteractionData ISlashCommandInteraction.Data => Data;
}
}

+ 7
- 1
src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs View File

@@ -6,7 +6,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a Websocket-based slash command received over the gateway.
/// </summary>
public class SocketMessageCommand : SocketCommandBase, IDiscordInteraction
public class SocketMessageCommand : SocketCommandBase, IMessageCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
@@ -34,6 +34,12 @@ namespace Discord.WebSocket
return entity;
}

//IMessageCommandInteraction
/// <inheritdoc/>
IMessageCommandInteractionData IMessageCommandInteraction.Data => Data;

//IDiscordInteraction
/// <inheritdoc/>
IDiscordInteractionData IDiscordInteraction.Data => Data;
}
}

+ 5
- 1
src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommandData.cs View File

@@ -7,7 +7,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents the data tied with the <see cref="SocketMessageCommand"/> interaction.
/// </summary>
public class SocketMessageCommandData : SocketCommandBaseData, IDiscordInteractionData
public class SocketMessageCommandData : SocketCommandBaseData, IMessageCommandInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the message associated with this message command.
@@ -31,5 +31,9 @@ namespace Discord.WebSocket
entity.Update(model);
return entity;
}

//IMessageCommandInteractionData
/// <inheritdoc/>
IMessage IMessageCommandInteractionData.Message => Message;
}
}

+ 7
- 1
src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/UserCommands/SocketUserCommand.cs View File

@@ -6,7 +6,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a Websocket-based slash command received over the gateway.
/// </summary>
public class SocketUserCommand : SocketCommandBase, IDiscordInteraction
public class SocketUserCommand : SocketCommandBase, IUserCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
@@ -34,6 +34,12 @@ namespace Discord.WebSocket
return entity;
}

//IUserCommandInteraction
/// <inheritdoc/>
IUserCommandInteractionData IUserCommandInteraction.Data => Data;

//IDiscordInteraction
/// <inheritdoc/>
IDiscordInteractionData IDiscordInteraction.Data => Data;
}
}

+ 5
- 1
src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/UserCommands/SocketUserCommandData.cs View File

@@ -7,7 +7,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents the data tied with the <see cref="SocketUserCommand"/> interaction.
/// </summary>
public class SocketUserCommandData : SocketCommandBaseData, IDiscordInteractionData
public class SocketUserCommandData : SocketCommandBaseData, IUserCommandInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the user who this command targets.
@@ -31,5 +31,9 @@ namespace Discord.WebSocket
entity.Update(model);
return entity;
}

//IUserCommandInteractionData
/// <inheritdoc/>
IUser IUserCommandInteractionData.User => Member;
}
}

+ 10
- 1
src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponent.cs View File

@@ -13,7 +13,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a Websocket-based interaction type for Message Components.
/// </summary>
public class SocketMessageComponent : SocketInteraction, IDiscordInteraction
public class SocketMessageComponent : SocketInteraction, IComponentInteraction, IDiscordInteraction
{
/// <summary>
/// Gets the data received with this interaction, contains the button that was clicked.
@@ -422,6 +422,15 @@ namespace Discord.WebSocket
}
}

//IComponentInteraction
/// <inheritdoc/>
IComponentInteractionData IComponentInteraction.Data => Data;

/// <inheritdoc/>
IUserMessage IComponentInteraction.Message => Message;

//IDiscordInteraction
/// <inheritdoc/>
IDiscordInteractionData IDiscordInteraction.Data => Data;
}
}

+ 1
- 1
src/Discord.Net.WebSocket/Entities/Interaction/MessageComponents/SocketMessageComponentData.cs View File

@@ -6,7 +6,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents the data sent with a <see cref="InteractionType.MessageComponent"/>.
/// </summary>
public class SocketMessageComponentData : IDiscordInteractionData
public class SocketMessageComponentData : IComponentInteractionData
{
/// <summary>
/// Gets the components Custom Id that was clicked.


+ 7
- 1
src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs View File

@@ -11,7 +11,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a <see cref="InteractionType.ApplicationCommandAutocomplete"/> received over the gateway.
/// </summary>
public class SocketAutocompleteInteraction : SocketInteraction, IDiscordInteraction
public class SocketAutocompleteInteraction : SocketInteraction, IAutocompleteInteraction, IDiscordInteraction
{
/// <summary>
/// The autocomplete data of this interaction.
@@ -115,6 +115,12 @@ namespace Discord.WebSocket
public override Task RespondAsync(string text = null, Embed[] embeds = null, bool isTTS = false, bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null, Embed embed = null)
=> throw new NotSupportedException("Autocomplete interactions cannot be deferred!");

//IAutocompleteInteraction
/// <inheritdoc/>
IAutocompleteInteractionData IAutocompleteInteraction.Data => Data;

//IDiscordInteraction
/// <inheritdoc/>
IDiscordInteractionData IDiscordInteraction.Data => Data;
}
}

+ 1
- 1
src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs View File

@@ -8,7 +8,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents data for a slash commands autocomplete interaction.
/// </summary>
public class SocketAutocompleteInteractionData : IDiscordInteractionData
public class SocketAutocompleteInteractionData : IAutocompleteInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the name of the invoked command.


+ 7
- 1
src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs View File

@@ -6,7 +6,7 @@ namespace Discord.WebSocket
/// <summary>
/// Represents a Websocket-based slash command received over the gateway.
/// </summary>
public class SocketSlashCommand : SocketCommandBase, IDiscordInteraction
public class SocketSlashCommand : SocketCommandBase, ISlashCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
@@ -34,6 +34,12 @@ namespace Discord.WebSocket
return entity;
}

//ISlashCommandInteraction
/// <inheritdoc/>
IApplicationCommandInteractionData ISlashCommandInteraction.Data => Data;

//IDiscordInteraction
/// <inheritdoc/>
IDiscordInteractionData IDiscordInteraction.Data => Data;
}
}

Loading…
Cancel
Save