Browse Source

Update interaction summaries (#2099)

* init

* Update RestMessageComponentData.cs

* Update src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

* Update src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>

Co-authored-by: Jared L <48422312+lhjt@users.noreply.github.com>
tags/3.3.1
Quin Lynch GitHub 3 years ago
parent
commit
503d32aa7e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 51 additions and 99 deletions
  1. +2
    -2
      src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs
  2. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs
  3. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs
  4. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs
  5. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs
  6. +3
    -9
      src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs
  7. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs
  8. +3
    -5
      src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs
  9. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/RestGuildCommand.cs
  10. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs
  11. +6
    -18
      src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs
  12. +1
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs
  13. +1
    -2
      src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs
  14. +3
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs
  15. +6
    -18
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs
  16. +1
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs
  17. +1
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommandDataOption.cs
  18. +3
    -3
      src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs
  19. +3
    -3
      src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs
  20. +2
    -1
      src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs
  21. +1
    -5
      src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs
  22. +8
    -22
      src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs

+ 2
- 2
src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs View File

@@ -50,12 +50,12 @@ namespace Discord
IUser User { get; }

/// <summary>
/// The preferred locale of the invoking User.
/// Gets the preferred locale of the invoking User.
/// </summary>
string UserLocale { get; }

/// <summary>
/// The preferred locale of the guild this interaction was executed in. <see cref="null"/> if not executed in a guild.
/// Gets the preferred locale of the guild this interaction was executed in. <see cref="null"/> if not executed in a guild.
/// </summary>
/// <remarks>
/// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord.


+ 1
- 1
src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs View File

@@ -28,7 +28,7 @@ namespace Discord.Rest
=> Data.Id;

/// <summary>
/// The data associated with this interaction.
/// Gets the data associated with this interaction.
/// </summary>
internal new RestCommandBaseData Data { get; private set; }



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

@@ -10,7 +10,7 @@ namespace Discord.Rest
public class RestMessageCommand : RestCommandBase, IMessageCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
/// Gets the data associated with this interaction.
/// </summary>
public new RestMessageCommandData Data { get; private set; }



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

@@ -20,7 +20,7 @@ namespace Discord.Rest

/// <inheritdoc/>
/// <remarks>
/// <b>Note</b> Not implemented for <see cref="SocketMessageCommandData"/>
/// <b>Note</b> Not implemented for <see cref="RestMessageCommandData"/>
/// </remarks>
public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options
=> throw new System.NotImplementedException();


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

@@ -18,7 +18,7 @@ namespace Discord.Rest

/// <inheritdoc/>
/// <remarks>
/// <b>Note</b> Not implemented for <see cref="SocketUserCommandData"/>
/// <b>Note</b> Not implemented for <see cref="RestUserCommandData"/>
/// </remarks>
public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options
=> throw new System.NotImplementedException();


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

@@ -12,19 +12,13 @@ namespace Discord.Rest
/// </summary>
public class RestMessageComponentData : IComponentInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the components Custom Id that was clicked.
/// </summary>
/// <inheritdoc/>
public string CustomId { get; }

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

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

/// <inheritdoc/>


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

@@ -28,7 +28,7 @@ namespace Discord.Rest
public bool IsDefaultPermission { get; private set; }

/// <summary>
/// The options of this command.
/// Gets a collection of options for this command.
/// </summary>
public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; }



+ 3
- 5
src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs View File

@@ -36,18 +36,16 @@ namespace Discord.Rest
public double? MaxValue { get; private set; }

/// <summary>
/// A collection of <see cref="RestApplicationCommandChoice"/>'s for this command.
/// Gets a collection of <see cref="RestApplicationCommandChoice"/>s for this command.
/// </summary>
public IReadOnlyCollection<RestApplicationCommandChoice> Choices { get; private set; }

/// <summary>
/// A collection of <see cref="RestApplicationCommandOption"/>'s for this command.
/// Gets a collection of <see cref="RestApplicationCommandOption"/>s for this command.
/// </summary>
public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; }

/// <summary>
/// The allowed channel types for this option.
/// </summary>
/// <inheritdoc/>
public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; }

internal RestApplicationCommandOption() { }


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

@@ -10,7 +10,7 @@ namespace Discord.Rest
public class RestGuildCommand : RestApplicationCommand
{
/// <summary>
/// The guild Id where this command originates.
/// Gets the guild Id where this command originates.
/// </summary>
public ulong GuildId { get; private set; }



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

@@ -43,7 +43,7 @@ namespace Discord.Rest
public DateTimeOffset CreatedAt { get; private set; }

/// <summary>
/// <see langword="true"/> if the token is valid for replying to, otherwise <see langword="false"/>.
/// Gets whether or not the token used to respond to this interaction is valid.
/// </summary>
public bool IsValidToken
=> InteractionHelper.CanRespondOrFollowup(this);


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

@@ -13,34 +13,22 @@ namespace Discord.Rest
/// </summary>
public class RestAutocompleteInteractionData : IAutocompleteInteractionData
{
/// <summary>
/// Gets the name of the invoked command.
/// </summary>
/// <inheritdoc/>
public string CommandName { get; }

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

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

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

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

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

internal RestAutocompleteInteractionData(DataModel model)


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

@@ -9,7 +9,7 @@ namespace Discord.WebSocket
public class SocketMessageCommand : SocketCommandBase, IMessageCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
/// Gets the data associated with this interaction.
/// </summary>
public new SocketMessageCommandData Data { get; }



+ 1
- 2
src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs View File

@@ -17,9 +17,8 @@ namespace Discord.WebSocket
public class SocketModal : SocketInteraction, IDiscordInteraction, IModalInteraction
{
/// <summary>
/// The data for this <see cref="Modal"/> interaction.
/// Gets the data for this <see cref="Modal"/> interaction.
/// </summary>
/// <value></value>
public new SocketModalData Data { get; set; }

internal SocketModal(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user)


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

@@ -14,11 +14,13 @@ namespace Discord.WebSocket
public class SocketAutocompleteInteraction : SocketInteraction, IAutocompleteInteraction, IDiscordInteraction
{
/// <summary>
/// The autocomplete data of this interaction.
/// Gets the autocomplete data of this interaction.
/// </summary>
public new SocketAutocompleteInteractionData Data { get; }

/// <inheritdoc/>
public override bool HasResponded { get; internal set; }

private object _lock = new object();

internal SocketAutocompleteInteraction(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user)


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

@@ -10,34 +10,22 @@ namespace Discord.WebSocket
/// </summary>
public class SocketAutocompleteInteractionData : IAutocompleteInteractionData, IDiscordInteractionData
{
/// <summary>
/// Gets the name of the invoked command.
/// </summary>
/// <inheritdoc/>
public string CommandName { get; }

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

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

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

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

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

internal SocketAutocompleteInteractionData(DataModel model)


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

@@ -9,7 +9,7 @@ namespace Discord.WebSocket
public class SocketSlashCommand : SocketCommandBase, ISlashCommandInteraction, IDiscordInteraction
{
/// <summary>
/// The data associated with this interaction.
/// Gets the data associated with this interaction.
/// </summary>
public new SocketSlashCommandData Data { get; }



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

@@ -21,7 +21,7 @@ namespace Discord.WebSocket
public ApplicationCommandOptionType Type { get; private set; }

/// <summary>
/// The sub command options received for this sub command group.
/// Gets the sub command options received for this sub command group.
/// </summary>
public IReadOnlyCollection<SocketSlashCommandDataOption> Options { get; private set; }



+ 3
- 3
src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs View File

@@ -16,7 +16,7 @@ namespace Discord.WebSocket
{
#region SocketApplicationCommand
/// <summary>
/// <see langword="true"/> if this command is a global command, otherwise <see langword="false"/>.
/// Gets whether or not this command is a global application command.
/// </summary>
public bool IsGlobalCommand
=> Guild == null;
@@ -37,7 +37,7 @@ namespace Discord.WebSocket
public bool IsDefaultPermission { get; private set; }

/// <summary>
/// A collection of <see cref="SocketApplicationCommandOption"/>'s for this command.
/// Gets a collection of <see cref="SocketApplicationCommandOption"/>s for this command.
/// </summary>
/// <remarks>
/// If the <see cref="Type"/> is not a slash command, this field will be an empty collection.
@@ -49,7 +49,7 @@ namespace Discord.WebSocket
=> SnowflakeUtils.FromSnowflake(Id);

/// <summary>
/// Returns the guild this command resides in, if this command is a global command then it will return <see langword="null"/>
/// Gets the guild this command resides in; if this command is a global command then it will return <see langword="null"/>
/// </summary>
public SocketGuild Guild
=> GuildId.HasValue ? Discord.GetGuild(GuildId.Value) : null;


+ 3
- 3
src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs View File

@@ -34,17 +34,17 @@ namespace Discord.WebSocket
public double? MaxValue { get; private set; }

/// <summary>
/// Choices for string and int types for the user to pick from.
/// Gets a collection of choices for the user to pick from.
/// </summary>
public IReadOnlyCollection<SocketApplicationCommandChoice> Choices { get; private set; }

/// <summary>
/// If the option is a subcommand or subcommand group type, this nested options will be the parameters.
/// Gets a collection of nested options.
/// </summary>
public IReadOnlyCollection<SocketApplicationCommandOption> Options { get; private set; }

/// <summary>
/// The allowed channel types for this option.
/// Gets the allowed channel types for this option.
/// </summary>
public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; }



+ 2
- 1
src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs View File

@@ -27,10 +27,11 @@ namespace Discord.WebSocket
=> Data.Id;

/// <summary>
/// The data associated with this interaction.
/// Gets the data associated with this interaction.
/// </summary>
internal new SocketCommandBaseData Data { get; }

/// <inheritdoc/>
public override bool HasResponded { get; internal set; }

private object _lock = new object();


+ 1
- 5
src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs View File

@@ -12,19 +12,15 @@ namespace Discord.WebSocket
public string Name { get; private set; }

/// <summary>
/// The <typeparamref name="TOption"/> received with this interaction.
/// Gets the <typeparamref name="TOption"/> received with this interaction.
/// </summary>
public virtual IReadOnlyCollection<TOption> Options { get; internal set; }

internal readonly SocketResolvableData<Model> ResolvableData;

private ApplicationCommandType Type { get; set; }

internal SocketCommandBaseData(DiscordSocketClient client, Model model, ulong? guildId)
: base(client, model.Id)
{
Type = model.Type;

if (model.Resolved.IsSpecified)
{
ResolvableData = new SocketResolvableData<Model>(client, guildId, model);


+ 8
- 22
src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs View File

@@ -16,7 +16,7 @@ namespace Discord.WebSocket
{
#region SocketInteraction
/// <summary>
/// The <see cref="ISocketMessageChannel"/> this interaction was used in.
/// Gets the <see cref="ISocketMessageChannel"/> this interaction was used in.
/// </summary>
/// <remarks>
/// If the channel isn't cached or the bot doesn't have access to it then
@@ -25,23 +25,17 @@ namespace Discord.WebSocket
public ISocketMessageChannel Channel { get; private set; }

/// <summary>
/// The <see cref="SocketUser"/> who triggered this interaction.
/// Gets the <see cref="SocketUser"/> who triggered this interaction.
/// </summary>
public SocketUser User { get; private set; }

/// <summary>
/// The type of this interaction.
/// </summary>
/// <inheritdoc/>
public InteractionType Type { get; private set; }

/// <summary>
/// The token used to respond to this interaction.
/// </summary>
/// <inheritdoc/>
public string Token { get; private set; }

/// <summary>
/// The data sent with this interaction.
/// </summary>
/// <inheritdoc/>
public IDiscordInteractionData Data { get; private set; }

/// <inheritdoc/>
@@ -50,25 +44,17 @@ namespace Discord.WebSocket
/// <inheritdoc/>
public string GuildLocale { get; private set; }

/// <summary>
/// The version of this interaction.
/// </summary>
/// <inheritdoc/>
public int Version { get; private set; }

/// <inheritdoc/>
public DateTimeOffset CreatedAt { get; private set; }

/// <summary>
/// Gets whether or not this interaction has been responded to.
/// </summary>
/// <remarks>
/// This property is locally set -- if you're running multiple bots
/// off the same token then this property won't be in sync with them.
/// </remarks>
/// <inheritdoc/>
public abstract bool HasResponded { get; internal set; }

/// <summary>
/// <see langword="true"/> if the token is valid for replying to, otherwise <see langword="false"/>.
/// Gets whether or not the token used to respond to this interaction is valid.
/// </summary>
public bool IsValidToken
=> InteractionHelper.CanRespondOrFollowup(this);


Loading…
Cancel
Save