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>
This commit is contained in:
Quin Lynch
2022-02-12 06:51:14 -04:00
committed by GitHub
parent 69da238a0f
commit 503d32aa7e
22 changed files with 51 additions and 99 deletions

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.

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; }

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; }

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();

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();

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/>

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; }

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() { }

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; }

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);

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)

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; }

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)

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)

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)

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; }

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; }

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;

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; }

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();

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);

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);