* 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>pull/2108/head
@@ -50,12 +50,12 @@ namespace Discord | |||||
IUser User { get; } | IUser User { get; } | ||||
/// <summary> | /// <summary> | ||||
/// The preferred locale of the invoking User. | |||||
/// Gets the preferred locale of the invoking User. | |||||
/// </summary> | /// </summary> | ||||
string UserLocale { get; } | string UserLocale { get; } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. | /// Non-community guilds (With no locale setting available) will have en-US as the default value sent by Discord. | ||||
@@ -28,7 +28,7 @@ namespace Discord.Rest | |||||
=> Data.Id; | => Data.Id; | ||||
/// <summary> | /// <summary> | ||||
/// The data associated with this interaction. | |||||
/// Gets the data associated with this interaction. | |||||
/// </summary> | /// </summary> | ||||
internal new RestCommandBaseData Data { get; private set; } | internal new RestCommandBaseData Data { get; private set; } | ||||
@@ -10,7 +10,7 @@ namespace Discord.Rest | |||||
public class RestMessageCommand : RestCommandBase, IMessageCommandInteraction, IDiscordInteraction | public class RestMessageCommand : RestCommandBase, IMessageCommandInteraction, IDiscordInteraction | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The data associated with this interaction. | |||||
/// Gets the data associated with this interaction. | |||||
/// </summary> | /// </summary> | ||||
public new RestMessageCommandData Data { get; private set; } | public new RestMessageCommandData Data { get; private set; } | ||||
@@ -20,7 +20,7 @@ namespace Discord.Rest | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
/// <remarks> | /// <remarks> | ||||
/// <b>Note</b> Not implemented for <see cref="SocketMessageCommandData"/> | |||||
/// <b>Note</b> Not implemented for <see cref="RestMessageCommandData"/> | |||||
/// </remarks> | /// </remarks> | ||||
public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options | public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options | ||||
=> throw new System.NotImplementedException(); | => throw new System.NotImplementedException(); | ||||
@@ -18,7 +18,7 @@ namespace Discord.Rest | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
/// <remarks> | /// <remarks> | ||||
/// <b>Note</b> Not implemented for <see cref="SocketUserCommandData"/> | |||||
/// <b>Note</b> Not implemented for <see cref="RestUserCommandData"/> | |||||
/// </remarks> | /// </remarks> | ||||
public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options | public override IReadOnlyCollection<IApplicationCommandInteractionDataOption> Options | ||||
=> throw new System.NotImplementedException(); | => throw new System.NotImplementedException(); | ||||
@@ -12,19 +12,13 @@ namespace Discord.Rest | |||||
/// </summary> | /// </summary> | ||||
public class RestMessageComponentData : IComponentInteractionData, IDiscordInteractionData | public class RestMessageComponentData : IComponentInteractionData, IDiscordInteractionData | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets the components Custom Id that was clicked. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public string CustomId { get; } | public string CustomId { get; } | ||||
/// <summary> | |||||
/// Gets the type of the component clicked. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ComponentType Type { get; } | public ComponentType Type { get; } | ||||
/// <summary> | |||||
/// Gets the value(s) of a <see cref="SelectMenuComponent"/> interaction response. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public IReadOnlyCollection<string> Values { get; } | public IReadOnlyCollection<string> Values { get; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
@@ -28,7 +28,7 @@ namespace Discord.Rest | |||||
public bool IsDefaultPermission { get; private set; } | public bool IsDefaultPermission { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// The options of this command. | |||||
/// Gets a collection of options for this command. | |||||
/// </summary> | /// </summary> | ||||
public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; } | public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; } | ||||
@@ -36,18 +36,16 @@ namespace Discord.Rest | |||||
public double? MaxValue { get; private set; } | public double? MaxValue { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// A collection of <see cref="RestApplicationCommandChoice"/>'s for this command. | |||||
/// Gets a collection of <see cref="RestApplicationCommandChoice"/>s for this command. | |||||
/// </summary> | /// </summary> | ||||
public IReadOnlyCollection<RestApplicationCommandChoice> Choices { get; private set; } | public IReadOnlyCollection<RestApplicationCommandChoice> Choices { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// A collection of <see cref="RestApplicationCommandOption"/>'s for this command. | |||||
/// Gets a collection of <see cref="RestApplicationCommandOption"/>s for this command. | |||||
/// </summary> | /// </summary> | ||||
public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; } | public IReadOnlyCollection<RestApplicationCommandOption> Options { get; private set; } | ||||
/// <summary> | |||||
/// The allowed channel types for this option. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | ||||
internal RestApplicationCommandOption() { } | internal RestApplicationCommandOption() { } | ||||
@@ -10,7 +10,7 @@ namespace Discord.Rest | |||||
public class RestGuildCommand : RestApplicationCommand | public class RestGuildCommand : RestApplicationCommand | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The guild Id where this command originates. | |||||
/// Gets the guild Id where this command originates. | |||||
/// </summary> | /// </summary> | ||||
public ulong GuildId { get; private set; } | public ulong GuildId { get; private set; } | ||||
@@ -43,7 +43,7 @@ namespace Discord.Rest | |||||
public DateTimeOffset CreatedAt { get; private set; } | public DateTimeOffset CreatedAt { get; private set; } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public bool IsValidToken | public bool IsValidToken | ||||
=> InteractionHelper.CanRespondOrFollowup(this); | => InteractionHelper.CanRespondOrFollowup(this); | ||||
@@ -13,34 +13,22 @@ namespace Discord.Rest | |||||
/// </summary> | /// </summary> | ||||
public class RestAutocompleteInteractionData : IAutocompleteInteractionData | public class RestAutocompleteInteractionData : IAutocompleteInteractionData | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets the name of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public string CommandName { get; } | public string CommandName { get; } | ||||
/// <summary> | |||||
/// Gets the id of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ulong CommandId { get; } | public ulong CommandId { get; } | ||||
/// <summary> | |||||
/// Gets the type of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ApplicationCommandType Type { get; } | public ApplicationCommandType Type { get; } | ||||
/// <summary> | |||||
/// Gets the version of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ulong Version { get; } | public ulong Version { get; } | ||||
/// <summary> | |||||
/// Gets the current autocomplete option that is actively being filled out. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public AutocompleteOption Current { get; } | 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; } | public IReadOnlyCollection<AutocompleteOption> Options { get; } | ||||
internal RestAutocompleteInteractionData(DataModel model) | internal RestAutocompleteInteractionData(DataModel model) | ||||
@@ -9,7 +9,7 @@ namespace Discord.WebSocket | |||||
public class SocketMessageCommand : SocketCommandBase, IMessageCommandInteraction, IDiscordInteraction | public class SocketMessageCommand : SocketCommandBase, IMessageCommandInteraction, IDiscordInteraction | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The data associated with this interaction. | |||||
/// Gets the data associated with this interaction. | |||||
/// </summary> | /// </summary> | ||||
public new SocketMessageCommandData Data { get; } | public new SocketMessageCommandData Data { get; } | ||||
@@ -17,9 +17,8 @@ namespace Discord.WebSocket | |||||
public class SocketModal : SocketInteraction, IDiscordInteraction, IModalInteraction | public class SocketModal : SocketInteraction, IDiscordInteraction, IModalInteraction | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The data for this <see cref="Modal"/> interaction. | |||||
/// Gets the data for this <see cref="Modal"/> interaction. | |||||
/// </summary> | /// </summary> | ||||
/// <value></value> | |||||
public new SocketModalData Data { get; set; } | public new SocketModalData Data { get; set; } | ||||
internal SocketModal(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user) | internal SocketModal(DiscordSocketClient client, ModelBase model, ISocketMessageChannel channel, SocketUser user) | ||||
@@ -14,11 +14,13 @@ namespace Discord.WebSocket | |||||
public class SocketAutocompleteInteraction : SocketInteraction, IAutocompleteInteraction, IDiscordInteraction | public class SocketAutocompleteInteraction : SocketInteraction, IAutocompleteInteraction, IDiscordInteraction | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The autocomplete data of this interaction. | |||||
/// Gets the autocomplete data of this interaction. | |||||
/// </summary> | /// </summary> | ||||
public new SocketAutocompleteInteractionData Data { get; } | public new SocketAutocompleteInteractionData Data { get; } | ||||
/// <inheritdoc/> | |||||
public override bool HasResponded { get; internal set; } | public override bool HasResponded { get; internal set; } | ||||
private object _lock = new object(); | private object _lock = new object(); | ||||
internal SocketAutocompleteInteraction(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) | internal SocketAutocompleteInteraction(DiscordSocketClient client, Model model, ISocketMessageChannel channel, SocketUser user) | ||||
@@ -10,34 +10,22 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
public class SocketAutocompleteInteractionData : IAutocompleteInteractionData, IDiscordInteractionData | public class SocketAutocompleteInteractionData : IAutocompleteInteractionData, IDiscordInteractionData | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets the name of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public string CommandName { get; } | public string CommandName { get; } | ||||
/// <summary> | |||||
/// Gets the id of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ulong CommandId { get; } | public ulong CommandId { get; } | ||||
/// <summary> | |||||
/// Gets the type of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ApplicationCommandType Type { get; } | public ApplicationCommandType Type { get; } | ||||
/// <summary> | |||||
/// Gets the version of the invoked command. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public ulong Version { get; } | public ulong Version { get; } | ||||
/// <summary> | |||||
/// Gets the current autocomplete option that is actively being filled out. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public AutocompleteOption Current { get; } | 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; } | public IReadOnlyCollection<AutocompleteOption> Options { get; } | ||||
internal SocketAutocompleteInteractionData(DataModel model) | internal SocketAutocompleteInteractionData(DataModel model) | ||||
@@ -9,7 +9,7 @@ namespace Discord.WebSocket | |||||
public class SocketSlashCommand : SocketCommandBase, ISlashCommandInteraction, IDiscordInteraction | public class SocketSlashCommand : SocketCommandBase, ISlashCommandInteraction, IDiscordInteraction | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The data associated with this interaction. | |||||
/// Gets the data associated with this interaction. | |||||
/// </summary> | /// </summary> | ||||
public new SocketSlashCommandData Data { get; } | public new SocketSlashCommandData Data { get; } | ||||
@@ -21,7 +21,7 @@ namespace Discord.WebSocket | |||||
public ApplicationCommandOptionType Type { get; private set; } | public ApplicationCommandOptionType Type { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// The sub command options received for this sub command group. | |||||
/// Gets the sub command options received for this sub command group. | |||||
/// </summary> | /// </summary> | ||||
public IReadOnlyCollection<SocketSlashCommandDataOption> Options { get; private set; } | public IReadOnlyCollection<SocketSlashCommandDataOption> Options { get; private set; } | ||||
@@ -16,7 +16,7 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
#region SocketApplicationCommand | #region SocketApplicationCommand | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public bool IsGlobalCommand | public bool IsGlobalCommand | ||||
=> Guild == null; | => Guild == null; | ||||
@@ -37,7 +37,7 @@ namespace Discord.WebSocket | |||||
public bool IsDefaultPermission { get; private set; } | public bool IsDefaultPermission { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// A collection of <see cref="SocketApplicationCommandOption"/>'s for this command. | |||||
/// Gets a collection of <see cref="SocketApplicationCommandOption"/>s for this command. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// If the <see cref="Type"/> is not a slash command, this field will be an empty collection. | /// 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); | => SnowflakeUtils.FromSnowflake(Id); | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public SocketGuild Guild | public SocketGuild Guild | ||||
=> GuildId.HasValue ? Discord.GetGuild(GuildId.Value) : null; | => GuildId.HasValue ? Discord.GetGuild(GuildId.Value) : null; | ||||
@@ -34,17 +34,17 @@ namespace Discord.WebSocket | |||||
public double? MaxValue { get; private set; } | public double? MaxValue { get; private set; } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public IReadOnlyCollection<SocketApplicationCommandChoice> Choices { get; private set; } | public IReadOnlyCollection<SocketApplicationCommandChoice> Choices { get; private set; } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public IReadOnlyCollection<SocketApplicationCommandOption> Options { get; private set; } | public IReadOnlyCollection<SocketApplicationCommandOption> Options { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// The allowed channel types for this option. | |||||
/// Gets the allowed channel types for this option. | |||||
/// </summary> | /// </summary> | ||||
public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | public IReadOnlyCollection<ChannelType> ChannelTypes { get; private set; } | ||||
@@ -27,10 +27,11 @@ namespace Discord.WebSocket | |||||
=> Data.Id; | => Data.Id; | ||||
/// <summary> | /// <summary> | ||||
/// The data associated with this interaction. | |||||
/// Gets the data associated with this interaction. | |||||
/// </summary> | /// </summary> | ||||
internal new SocketCommandBaseData Data { get; } | internal new SocketCommandBaseData Data { get; } | ||||
/// <inheritdoc/> | |||||
public override bool HasResponded { get; internal set; } | public override bool HasResponded { get; internal set; } | ||||
private object _lock = new object(); | private object _lock = new object(); | ||||
@@ -12,19 +12,15 @@ namespace Discord.WebSocket | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// The <typeparamref name="TOption"/> received with this interaction. | |||||
/// Gets the <typeparamref name="TOption"/> received with this interaction. | |||||
/// </summary> | /// </summary> | ||||
public virtual IReadOnlyCollection<TOption> Options { get; internal set; } | public virtual IReadOnlyCollection<TOption> Options { get; internal set; } | ||||
internal readonly SocketResolvableData<Model> ResolvableData; | internal readonly SocketResolvableData<Model> ResolvableData; | ||||
private ApplicationCommandType Type { get; set; } | |||||
internal SocketCommandBaseData(DiscordSocketClient client, Model model, ulong? guildId) | internal SocketCommandBaseData(DiscordSocketClient client, Model model, ulong? guildId) | ||||
: base(client, model.Id) | : base(client, model.Id) | ||||
{ | { | ||||
Type = model.Type; | |||||
if (model.Resolved.IsSpecified) | if (model.Resolved.IsSpecified) | ||||
{ | { | ||||
ResolvableData = new SocketResolvableData<Model>(client, guildId, model); | ResolvableData = new SocketResolvableData<Model>(client, guildId, model); | ||||
@@ -16,7 +16,7 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
#region SocketInteraction | #region SocketInteraction | ||||
/// <summary> | /// <summary> | ||||
/// The <see cref="ISocketMessageChannel"/> this interaction was used in. | |||||
/// Gets the <see cref="ISocketMessageChannel"/> this interaction was used in. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// If the channel isn't cached or the bot doesn't have access to it then | /// 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; } | public ISocketMessageChannel Channel { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// The <see cref="SocketUser"/> who triggered this interaction. | |||||
/// Gets the <see cref="SocketUser"/> who triggered this interaction. | |||||
/// </summary> | /// </summary> | ||||
public SocketUser User { get; private set; } | public SocketUser User { get; private set; } | ||||
/// <summary> | |||||
/// The type of this interaction. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public InteractionType Type { get; private set; } | public InteractionType Type { get; private set; } | ||||
/// <summary> | |||||
/// The token used to respond to this interaction. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public string Token { get; private set; } | public string Token { get; private set; } | ||||
/// <summary> | |||||
/// The data sent with this interaction. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public IDiscordInteractionData Data { get; private set; } | public IDiscordInteractionData Data { get; private set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
@@ -50,25 +44,17 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public string GuildLocale { get; private set; } | public string GuildLocale { get; private set; } | ||||
/// <summary> | |||||
/// The version of this interaction. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public int Version { get; private set; } | public int Version { get; private set; } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public DateTimeOffset CreatedAt { get; private set; } | 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; } | public abstract bool HasResponded { get; internal set; } | ||||
/// <summary> | /// <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> | /// </summary> | ||||
public bool IsValidToken | public bool IsValidToken | ||||
=> InteractionHelper.CanRespondOrFollowup(this); | => InteractionHelper.CanRespondOrFollowup(this); | ||||