From 503d32aa7e353b964a33e1897a4503df710c8971 Mon Sep 17 00:00:00 2001 From: Quin Lynch <49576606+quinchs@users.noreply.github.com> Date: Sat, 12 Feb 2022 06:51:14 -0400 Subject: [PATCH] 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> --- .../Interactions/IDiscordInteraction.cs | 4 +-- .../CommandBase/RestCommandBase.cs | 2 +- .../MessageCommands/RestMessageCommand.cs | 2 +- .../MessageCommands/RestMessageCommandData.cs | 2 +- .../UserCommands/RestUserCommandData.cs | 2 +- .../RestMessageComponentData.cs | 12 ++------ .../Interactions/RestApplicationCommand.cs | 2 +- .../RestApplicationCommandOption.cs | 8 ++--- .../Entities/Interactions/RestGuildCommand.cs | 2 +- .../Entities/Interactions/RestInteraction.cs | 2 +- .../RestAutocompleteInteractionData.cs | 24 ++++----------- .../MessageCommands/SocketMessageCommand.cs | 2 +- .../Interaction/Modals/SocketModal.cs | 3 +- .../SocketAutocompleteInteraction.cs | 4 ++- .../SocketAutocompleteInteractionData.cs | 24 ++++----------- .../SlashCommands/SocketSlashCommand.cs | 2 +- .../SocketSlashCommandDataOption.cs | 2 +- .../SocketApplicationCommand.cs | 6 ++-- .../SocketApplicationCommandOption.cs | 6 ++-- .../SocketBaseCommand/SocketCommandBase.cs | 3 +- .../SocketCommandBaseData.cs | 6 +--- .../Entities/Interaction/SocketInteraction.cs | 30 +++++-------------- 22 files changed, 51 insertions(+), 99 deletions(-) diff --git a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs index 0741ce138..8f6bef995 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs @@ -50,12 +50,12 @@ namespace Discord IUser User { get; } /// - /// The preferred locale of the invoking User. + /// Gets the preferred locale of the invoking User. /// string UserLocale { get; } /// - /// The preferred locale of the guild this interaction was executed in. if not executed in a guild. + /// Gets the preferred locale of the guild this interaction was executed in. if not executed in a guild. /// /// /// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. diff --git a/src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs b/src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs index bb2e2c27d..196416f0e 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/CommandBase/RestCommandBase.cs @@ -28,7 +28,7 @@ namespace Discord.Rest => Data.Id; /// - /// The data associated with this interaction. + /// Gets the data associated with this interaction. /// internal new RestCommandBaseData Data { get; private set; } diff --git a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs index 7a85d2e0a..609fe0829 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommand.cs @@ -10,7 +10,7 @@ namespace Discord.Rest public class RestMessageCommand : RestCommandBase, IMessageCommandInteraction, IDiscordInteraction { /// - /// The data associated with this interaction. + /// Gets the data associated with this interaction. /// public new RestMessageCommandData Data { get; private set; } diff --git a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs index 8eadab617..127d539d9 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/MessageCommands/RestMessageCommandData.cs @@ -20,7 +20,7 @@ namespace Discord.Rest /// /// - /// Note Not implemented for + /// Note Not implemented for /// public override IReadOnlyCollection Options => throw new System.NotImplementedException(); diff --git a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs index 7563eecc7..e18499d42 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/ContextMenuCommands/UserCommands/RestUserCommandData.cs @@ -18,7 +18,7 @@ namespace Discord.Rest /// /// - /// Note Not implemented for + /// Note Not implemented for /// public override IReadOnlyCollection Options => throw new System.NotImplementedException(); diff --git a/src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs b/src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs index d065b258f..b0efe418c 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/MessageComponents/RestMessageComponentData.cs @@ -12,19 +12,13 @@ namespace Discord.Rest /// public class RestMessageComponentData : IComponentInteractionData, IDiscordInteractionData { - /// - /// Gets the components Custom Id that was clicked. - /// + /// public string CustomId { get; } - /// - /// Gets the type of the component clicked. - /// + /// public ComponentType Type { get; } - /// - /// Gets the value(s) of a interaction response. - /// + /// public IReadOnlyCollection Values { get; } /// diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs index c3edaf6ff..ea8d5bc42 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommand.cs @@ -28,7 +28,7 @@ namespace Discord.Rest public bool IsDefaultPermission { get; private set; } /// - /// The options of this command. + /// Gets a collection of options for this command. /// public IReadOnlyCollection Options { get; private set; } diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs index 1273b9a1e..86c6019ed 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestApplicationCommandOption.cs @@ -36,18 +36,16 @@ namespace Discord.Rest public double? MaxValue { get; private set; } /// - /// A collection of 's for this command. + /// Gets a collection of s for this command. /// public IReadOnlyCollection Choices { get; private set; } /// - /// A collection of 's for this command. + /// Gets a collection of s for this command. /// public IReadOnlyCollection Options { get; private set; } - /// - /// The allowed channel types for this option. - /// + /// public IReadOnlyCollection ChannelTypes { get; private set; } internal RestApplicationCommandOption() { } diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestGuildCommand.cs b/src/Discord.Net.Rest/Entities/Interactions/RestGuildCommand.cs index 00804e57e..9d9ecc91b 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestGuildCommand.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestGuildCommand.cs @@ -10,7 +10,7 @@ namespace Discord.Rest public class RestGuildCommand : RestApplicationCommand { /// - /// The guild Id where this command originates. + /// Gets the guild Id where this command originates. /// public ulong GuildId { get; private set; } diff --git a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs index 6069cf0e2..8a8921abe 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/RestInteraction.cs @@ -43,7 +43,7 @@ namespace Discord.Rest public DateTimeOffset CreatedAt { get; private set; } /// - /// if the token is valid for replying to, otherwise . + /// Gets whether or not the token used to respond to this interaction is valid. /// public bool IsValidToken => InteractionHelper.CanRespondOrFollowup(this); diff --git a/src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs b/src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs index 135eb88ea..a723745ba 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/SlashCommands/RestAutocompleteInteractionData.cs @@ -13,34 +13,22 @@ namespace Discord.Rest /// public class RestAutocompleteInteractionData : IAutocompleteInteractionData { - /// - /// Gets the name of the invoked command. - /// + /// public string CommandName { get; } - /// - /// Gets the id of the invoked command. - /// + /// public ulong CommandId { get; } - /// - /// Gets the type of the invoked command. - /// + /// public ApplicationCommandType Type { get; } - /// - /// Gets the version of the invoked command. - /// + /// public ulong Version { get; } - /// - /// Gets the current autocomplete option that is actively being filled out. - /// + /// public AutocompleteOption Current { get; } - /// - /// Gets a collection of all the other options the executing users has filled out. - /// + /// public IReadOnlyCollection Options { get; } internal RestAutocompleteInteractionData(DataModel model) diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs b/src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs index e4198a183..ad5575caa 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/ContextMenuCommands/MessageCommands/SocketMessageCommand.cs @@ -9,7 +9,7 @@ namespace Discord.WebSocket public class SocketMessageCommand : SocketCommandBase, IMessageCommandInteraction, IDiscordInteraction { /// - /// The data associated with this interaction. + /// Gets the data associated with this interaction. /// public new SocketMessageCommandData Data { get; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs b/src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs index e59bed6ec..cfbd3096d 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/Modals/SocketModal.cs @@ -17,9 +17,8 @@ namespace Discord.WebSocket public class SocketModal : SocketInteraction, IDiscordInteraction, IModalInteraction { /// - /// The data for this interaction. + /// Gets the data for this interaction. /// - /// public new SocketModalData Data { get; set; } internal SocketModal(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user) diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs index 449f074f5..58afc7896 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteraction.cs @@ -14,11 +14,13 @@ namespace Discord.WebSocket public class SocketAutocompleteInteraction : SocketInteraction, IAutocompleteInteraction, IDiscordInteraction { /// - /// The autocomplete data of this interaction. + /// Gets the autocomplete data of this interaction. /// public new SocketAutocompleteInteractionData Data { get; } + /// public override bool HasResponded { get; internal set; } + private object _lock = new object(); internal SocketAutocompleteInteraction(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs index 1d9803c02..dba3de355 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketAutocompleteInteractionData.cs @@ -10,34 +10,22 @@ namespace Discord.WebSocket /// public class SocketAutocompleteInteractionData : IAutocompleteInteractionData, IDiscordInteractionData { - /// - /// Gets the name of the invoked command. - /// + /// public string CommandName { get; } - /// - /// Gets the id of the invoked command. - /// + /// public ulong CommandId { get; } - /// - /// Gets the type of the invoked command. - /// + /// public ApplicationCommandType Type { get; } - /// - /// Gets the version of the invoked command. - /// + /// public ulong Version { get; } - /// - /// Gets the current autocomplete option that is actively being filled out. - /// + /// public AutocompleteOption Current { get; } - /// - /// Gets a collection of all the other options the executing users has filled out. - /// + /// public IReadOnlyCollection Options { get; } internal SocketAutocompleteInteractionData(DataModel model) diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs index 5f7e72ba0..b3aa4a826 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommand.cs @@ -9,7 +9,7 @@ namespace Discord.WebSocket public class SocketSlashCommand : SocketCommandBase, ISlashCommandInteraction, IDiscordInteraction { /// - /// The data associated with this interaction. + /// Gets the data associated with this interaction. /// public new SocketSlashCommandData Data { get; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommandDataOption.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommandDataOption.cs index 2a44b4e03..29a635266 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommandDataOption.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SlashCommands/SocketSlashCommandDataOption.cs @@ -21,7 +21,7 @@ namespace Discord.WebSocket public ApplicationCommandOptionType Type { get; private set; } /// - /// The sub command options received for this sub command group. + /// Gets the sub command options received for this sub command group. /// public IReadOnlyCollection Options { get; private set; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs index d986a93f3..36eba0cd1 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommand.cs @@ -16,7 +16,7 @@ namespace Discord.WebSocket { #region SocketApplicationCommand /// - /// if this command is a global command, otherwise . + /// Gets whether or not this command is a global application command. /// public bool IsGlobalCommand => Guild == null; @@ -37,7 +37,7 @@ namespace Discord.WebSocket public bool IsDefaultPermission { get; private set; } /// - /// A collection of 's for this command. + /// Gets a collection of s for this command. /// /// /// If the is not a slash command, this field will be an empty collection. @@ -49,7 +49,7 @@ namespace Discord.WebSocket => SnowflakeUtils.FromSnowflake(Id); /// - /// Returns the guild this command resides in, if this command is a global command then it will return + /// Gets the guild this command resides in; if this command is a global command then it will return /// public SocketGuild Guild => GuildId.HasValue ? Discord.GetGuild(GuildId.Value) : null; diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs index bdb03c8b0..27777749a 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketApplicationCommandOption.cs @@ -34,17 +34,17 @@ namespace Discord.WebSocket public double? MaxValue { get; private set; } /// - /// Choices for string and int types for the user to pick from. + /// Gets a collection of choices for the user to pick from. /// public IReadOnlyCollection Choices { get; private set; } /// - /// If the option is a subcommand or subcommand group type, this nested options will be the parameters. + /// Gets a collection of nested options. /// public IReadOnlyCollection Options { get; private set; } /// - /// The allowed channel types for this option. + /// Gets the allowed channel types for this option. /// public IReadOnlyCollection ChannelTypes { get; private set; } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs index 6cf74ce17..273f27c9c 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs @@ -27,10 +27,11 @@ namespace Discord.WebSocket => Data.Id; /// - /// The data associated with this interaction. + /// Gets the data associated with this interaction. /// internal new SocketCommandBaseData Data { get; } + /// public override bool HasResponded { get; internal set; } private object _lock = new object(); diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs index cb2f01f5f..3d6218982 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBaseData.cs @@ -12,19 +12,15 @@ namespace Discord.WebSocket public string Name { get; private set; } /// - /// The received with this interaction. + /// Gets the received with this interaction. /// public virtual IReadOnlyCollection Options { get; internal set; } internal readonly SocketResolvableData 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(client, guildId, model); diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs index 83b458e0c..8b5bd9c32 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs @@ -16,7 +16,7 @@ namespace Discord.WebSocket { #region SocketInteraction /// - /// The this interaction was used in. + /// Gets the this interaction was used in. /// /// /// 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; } /// - /// The who triggered this interaction. + /// Gets the who triggered this interaction. /// public SocketUser User { get; private set; } - /// - /// The type of this interaction. - /// + /// public InteractionType Type { get; private set; } - /// - /// The token used to respond to this interaction. - /// + /// public string Token { get; private set; } - /// - /// The data sent with this interaction. - /// + /// public IDiscordInteractionData Data { get; private set; } /// @@ -50,25 +44,17 @@ namespace Discord.WebSocket /// public string GuildLocale { get; private set; } - /// - /// The version of this interaction. - /// + /// public int Version { get; private set; } /// public DateTimeOffset CreatedAt { get; private set; } - /// - /// Gets whether or not this interaction has been responded to. - /// - /// - /// 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. - /// + /// public abstract bool HasResponded { get; internal set; } /// - /// if the token is valid for replying to, otherwise . + /// Gets whether or not the token used to respond to this interaction is valid. /// public bool IsValidToken => InteractionHelper.CanRespondOrFollowup(this);