@@ -3747,6 +3747,13 @@ | |||
<param name="options">The options to be used when sending the request.</param> | |||
<returns>A guild user associated with the specified <paramref name="userId" />; <see langword="null" /> if the user is already in the guild.</returns> | |||
</member> | |||
<member name="M:Discord.IGuild.DisconnectAsync(Discord.IGuildUser)"> | |||
<summary> | |||
Disconnects the user from its current voice channel | |||
</summary> | |||
<param name="user">The user to disconnect.</param> | |||
<returns>A task that represents the asynchronous operation for disconnecting a user.</returns> | |||
</member> | |||
<member name="M:Discord.IGuild.GetUsersAsync(Discord.CacheMode,Discord.RequestOptions)"> | |||
<summary> | |||
Gets a collection of all users in this guild. | |||
@@ -3936,6 +3943,14 @@ | |||
emote. | |||
</returns> | |||
</member> | |||
<member name="M:Discord.IGuild.MoveAsync(Discord.IGuildUser,Discord.IVoiceChannel)"> | |||
<summary> | |||
Moves the user to the voice channel. | |||
</summary> | |||
<param name="user">The user to move.</param> | |||
<param name="targetChannel">the channel where the user gets moved to.</param> | |||
<returns>A task that represents the asynchronous operation for moving a user.</returns> | |||
</member> | |||
<member name="M:Discord.IGuild.DeleteEmoteAsync(Discord.GuildEmote,Discord.RequestOptions)"> | |||
<summary> | |||
Deletes an existing <see cref="T:Discord.GuildEmote"/> from this guild. | |||
@@ -4992,6 +5007,16 @@ | |||
ACK a Ping. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.InteractionResponseType.Acknowledge"> | |||
<summary> | |||
ACK a command without sending a message, eating the user's input. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.InteractionResponseType.ChannelMessage"> | |||
<summary> | |||
Respond with a message, showing the user's input. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.InteractionResponseType.ChannelMessageWithSource"> | |||
<summary> | |||
Respond to an interaction with a message. | |||
@@ -5129,11 +5154,6 @@ | |||
Represents a builder for creating a <see cref="T:Discord.MessageComponent"/>. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.ComponentBuilder.MaxButtonLabelLength"> | |||
<summary> | |||
The max length of a <see cref="P:Discord.ButtonComponent.Label"/>. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.ComponentBuilder.MaxCustomIdLength"> | |||
<summary> | |||
The max length of a <see cref="P:Discord.ButtonComponent.CustomId"/>. | |||
@@ -5266,7 +5286,7 @@ | |||
Represents a class used to build <see cref="T:Discord.ButtonComponent"/>'s. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.ButtonBuilder.MaxLabelLength"> | |||
<member name="F:Discord.ButtonBuilder.MaxButtonLabelLength"> | |||
<summary> | |||
The max length of a <see cref="P:Discord.ButtonComponent.Label"/>. | |||
</summary> | |||
@@ -5275,13 +5295,15 @@ | |||
<summary> | |||
Gets or sets the label of the current button. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.Label"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxButtonLabelLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.Label"/> length exceeds <see cref="F:Discord.ButtonBuilder.MaxButtonLabelLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.Label"/> length exceeds <see cref="F:Discord.ButtonBuilder.MaxButtonLabelLength"/>.</exception> | |||
</member> | |||
<member name="P:Discord.ButtonBuilder.CustomId"> | |||
<summary> | |||
Gets or sets the custom id of the current button. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.CustomId"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxCustomIdLength"/></exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.ButtonBuilder.CustomId"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.ButtonBuilder.Style"> | |||
<summary> | |||
@@ -5448,13 +5470,15 @@ | |||
<summary> | |||
Gets or sets the custom id of the current select menu. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuBuilder.CustomId"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxCustomIdLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuBuilder.CustomId"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxCustomIdLength"/></exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuBuilder.CustomId"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.SelectMenuBuilder.Placeholder"> | |||
<summary> | |||
Gets or sets the placeholder text of the current select menu. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuBuilder.Placeholder"/> length exceeds <see cref="F:Discord.SelectMenuBuilder.MaxPlaceholderLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuBuilder.Placeholder"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.SelectMenuBuilder.MinValues"> | |||
<summary> | |||
@@ -5595,7 +5619,7 @@ | |||
Represents a class used to build <see cref="T:Discord.SelectMenuOption"/>'s. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.SelectMenuOptionBuilder.MaxLabelLength"> | |||
<member name="F:Discord.SelectMenuOptionBuilder.MaxSelectLabelLength"> | |||
<summary> | |||
The maximum length of a <see cref="P:Discord.SelectMenuOption.Label"/>. | |||
</summary> | |||
@@ -5605,9 +5629,9 @@ | |||
The maximum length of a <see cref="P:Discord.SelectMenuOption.Description"/>. | |||
</summary> | |||
</member> | |||
<member name="F:Discord.SelectMenuOptionBuilder.MaxSelectLabelLength"> | |||
<member name="F:Discord.SelectMenuOptionBuilder.MaxSelectValueLength"> | |||
<summary> | |||
The maximum length of a <see cref="P:Discord.SelectMenuOption.Label"/>. | |||
The maximum length of a <see cref="P:Discord.SelectMenuOption.Value"/>. | |||
</summary> | |||
</member> | |||
<member name="P:Discord.SelectMenuOptionBuilder.Label"> | |||
@@ -5615,18 +5639,21 @@ | |||
Gets or sets the label of the current select menu. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Label"/> length exceeds <see cref="F:Discord.SelectMenuOptionBuilder.MaxSelectLabelLength"/></exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Label"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.SelectMenuOptionBuilder.Value"> | |||
<summary> | |||
Gets or sets the custom id of the current select menu. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Value"/> length exceeds <see cref="F:Discord.ComponentBuilder.MaxCustomIdLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Value"/> length exceeds <see cref="F:Discord.SelectMenuOptionBuilder.MaxSelectValueLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Value"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.SelectMenuOptionBuilder.Description"> | |||
<summary> | |||
Gets or sets this menu options description. | |||
</summary> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Description"/> length exceeds <see cref="F:Discord.SelectMenuOptionBuilder.MaxDescriptionLength"/>.</exception> | |||
<exception cref="T:System.ArgumentException" accessor="set"><see cref="P:Discord.SelectMenuOptionBuilder.Label"/> length subceeds 1.</exception> | |||
</member> | |||
<member name="P:Discord.SelectMenuOptionBuilder.Emote"> | |||
<summary> | |||
@@ -3617,6 +3617,14 @@ | |||
<inheritdoc /> | |||
<exception cref="T:System.ArgumentNullException"><paramref name="func"/> is <see langword="null"/>.</exception> | |||
</member> | |||
<member name="M:Discord.Rest.RestGuild.MoveAsync(Discord.IGuildUser,Discord.IVoiceChannel)"> | |||
<summary> | |||
Moves the user to the voice channel. | |||
</summary> | |||
<param name="user">The user to move.</param> | |||
<param name="targetChannel">the channel where the user gets moved to.</param> | |||
<returns>A task that represents the asynchronous operation for moving a user.</returns> | |||
</member> | |||
<member name="M:Discord.Rest.RestGuild.DeleteEmoteAsync(Discord.GuildEmote,Discord.RequestOptions)"> | |||
<inheritdoc /> | |||
</member> | |||
@@ -3802,6 +3810,13 @@ | |||
<member name="M:Discord.Rest.RestGuild.Discord#IGuild#AddGuildUserAsync(System.UInt64,System.String,System.Action{Discord.AddGuildUserProperties},Discord.RequestOptions)"> | |||
<inheritdoc /> | |||
</member> | |||
<member name="M:Discord.Rest.RestGuild.Discord#IGuild#DisconnectAsync(Discord.IGuildUser)"> | |||
<summary> | |||
Disconnects the user from its current voice channel | |||
</summary> | |||
<param name="user">The user to disconnect.</param> | |||
<returns>A task that represents the asynchronous operation for disconnecting a user.</returns> | |||
</member> | |||
<member name="M:Discord.Rest.RestGuild.Discord#IGuild#GetUserAsync(System.UInt64,Discord.CacheMode,Discord.RequestOptions)"> | |||
<inheritdoc /> | |||
</member> | |||
@@ -897,7 +897,7 @@ namespace Discord.API | |||
} | |||
#endregion | |||
#region Stickers | |||
#region Stickers, Reactions, Crosspost, and Acks | |||
public async Task<Sticker> GetStickerAsync(ulong id, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(id, 0, nameof(id)); | |||
@@ -1166,25 +1166,25 @@ namespace Discord.API | |||
options = RequestOptions.CreateOrClone(options); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{this.CurrentUserId}/commands", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{this.CurrentUserId}/commands", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand> ModifyGlobalApplicationCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand> ModifyGlobalApplicationUserCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand> ModifyGlobalApplicationMessageCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); | |||
} | |||
public async Task DeleteGlobalApplicationCommandAsync(ulong commandId, RequestOptions options = null) | |||
{ | |||
@@ -1193,11 +1193,11 @@ namespace Discord.API | |||
await SendAsync("DELETE", () => $"applications/{this.CurrentUserId}/commands/{commandId}", new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand[]> BulkOverwriteGlobalApplicationCommands(CreateApplicationCommandParams[] commands, RequestOptions options = null) | |||
public async Task<ApplicationCommand[]> BulkOverwriteGlobalApplicationCommandsAsync(CreateApplicationCommandParams[] commands, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{this.CurrentUserId}/commands", commands, new BucketIds(), options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{this.CurrentUserId}/commands", commands, new BucketIds(), options: options)).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand[]> GetGuildApplicationCommandsAsync(ulong guildId, RequestOptions options = null) | |||
@@ -1239,7 +1239,7 @@ namespace Discord.API | |||
var bucket = new BucketIds(guildId: guildId); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", command, bucket, options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("POST", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", command, bucket, options: options)).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand> ModifyGuildApplicationCommandAsync(ModifyApplicationCommandParams command, ulong guildId, ulong commandId, RequestOptions options = null) | |||
{ | |||
@@ -1247,7 +1247,7 @@ namespace Discord.API | |||
var bucket = new BucketIds(guildId: guildId); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false); | |||
} | |||
public async Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId, RequestOptions options = null) | |||
{ | |||
@@ -1258,18 +1258,18 @@ namespace Discord.API | |||
await SendAsync<ApplicationCommand>("DELETE", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", bucket, options: options).ConfigureAwait(false); | |||
} | |||
public async Task<ApplicationCommand[]> BulkOverwriteGuildApplicationCommands(ulong guildId, CreateApplicationCommandParams[] commands, RequestOptions options = null) | |||
public async Task<ApplicationCommand[]> BulkOverwriteGuildApplicationCommandsAsync(ulong guildId, CreateApplicationCommandParams[] commands, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
var bucket = new BucketIds(guildId: guildId); | |||
return await TrySendApplicationCommand(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", commands, bucket, options: options)).ConfigureAwait(false); | |||
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand[]>("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", commands, bucket, options: options)).ConfigureAwait(false); | |||
} | |||
#endregion | |||
#region Interaction Responses | |||
public async Task CreateInteractionResponse(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null) | |||
public async Task CreateInteractionResponseAsync(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null) | |||
{ | |||
if(response.Data.IsSpecified && response.Data.Value.Content.IsSpecified) | |||
Preconditions.AtMost(response.Data.Value.Content.Value?.Length ?? 0, 2000, nameof(response.Data.Value.Content)); | |||
@@ -1278,7 +1278,7 @@ namespace Discord.API | |||
await SendJsonAsync<Message>("POST", () => $"interactions/{interactionId}/{interactionToken}/callback", response, new BucketIds(), options: options); | |||
} | |||
public async Task<Message> GetInteractionResponse(string interactionToken, RequestOptions options = null) | |||
public async Task<Message> GetInteractionResponseAsync(string interactionToken, RequestOptions options = null) | |||
{ | |||
Preconditions.NotNullOrEmpty(interactionToken, nameof(interactionToken)); | |||
@@ -1286,20 +1286,20 @@ namespace Discord.API | |||
return await SendAsync<Message>("GET", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<Message> ModifyInteractionResponse(ModifyInteractionResponseParams args, string interactionToken, RequestOptions options = null) | |||
public async Task<Message> ModifyInteractionResponseAsync(ModifyInteractionResponseParams args, string interactionToken, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
return await SendJsonAsync<Message>("PATCH", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", args, new BucketIds(), options: options); | |||
} | |||
public async Task DeleteInteractionResponse(string interactionToken, RequestOptions options = null) | |||
public async Task DeleteInteractionResponseAsync(string interactionToken, RequestOptions options = null) | |||
{ | |||
options = RequestOptions.CreateOrClone(options); | |||
await SendAsync("DELETE", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options); | |||
} | |||
public async Task<Message> CreateInteractionFollowupMessage(CreateWebhookMessageParams args, string token, RequestOptions options = null) | |||
public async Task<Message> CreateInteractionFollowupMessageAsync(CreateWebhookMessageParams args, string token, RequestOptions options = null) | |||
{ | |||
if ((!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0) && !args.File.IsSpecified) | |||
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content)); | |||
@@ -1315,7 +1315,7 @@ namespace Discord.API | |||
return await SendMultipartAsync<Message>("POST", () => $"webhooks/{CurrentUserId}/{token}?wait=true", args.ToDictionary(), new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<Message> ModifyInteractionFollowupMessage(ModifyInteractionResponseParams args, ulong id, string token, RequestOptions options = null) | |||
public async Task<Message> ModifyInteractionFollowupMessageAsync(ModifyInteractionResponseParams args, ulong id, string token, RequestOptions options = null) | |||
{ | |||
Preconditions.NotNull(args, nameof(args)); | |||
Preconditions.NotEqual(id, 0, nameof(id)); | |||
@@ -1329,7 +1329,7 @@ namespace Discord.API | |||
return await SendJsonAsync<Message>("PATCH", () => $"webhooks/{CurrentUserId}/{token}/messages/{id}", args, new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task DeleteInteractionFollowupMessage(ulong id, string token, RequestOptions options = null) | |||
public async Task DeleteInteractionFollowupMessageAsync(ulong id, string token, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(id, 0, nameof(id)); | |||
@@ -1340,7 +1340,7 @@ namespace Discord.API | |||
#endregion | |||
#region Application Command permissions | |||
public async Task<GuildApplicationCommandPermission[]> GetGuildApplicationCommandPermissions(ulong guildId, RequestOptions options = null) | |||
public async Task<GuildApplicationCommandPermission[]> GetGuildApplicationCommandPermissionsAsync(ulong guildId, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||
@@ -1349,7 +1349,7 @@ namespace Discord.API | |||
return await SendAsync<GuildApplicationCommandPermission[]>("GET", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/permissions", new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<GuildApplicationCommandPermission> GetGuildApplicationCommandPermission(ulong guildId, ulong commandId, RequestOptions options = null) | |||
public async Task<GuildApplicationCommandPermission> GetGuildApplicationCommandPermissionAsync(ulong guildId, ulong commandId, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||
Preconditions.NotEqual(commandId, 0, nameof(commandId)); | |||
@@ -1359,7 +1359,7 @@ namespace Discord.API | |||
return await SendAsync<GuildApplicationCommandPermission>("GET", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<GuildApplicationCommandPermission> ModifyApplicationCommandPermissions(ModifyGuildApplicationCommandPermissionsParams permissions, ulong guildId, ulong commandId, RequestOptions options = null) | |||
public async Task<GuildApplicationCommandPermission> ModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissionsParams permissions, ulong guildId, ulong commandId, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||
Preconditions.NotEqual(commandId, 0, nameof(commandId)); | |||
@@ -1369,7 +1369,7 @@ namespace Discord.API | |||
return await SendJsonAsync<GuildApplicationCommandPermission>("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", permissions, new BucketIds(), options: options).ConfigureAwait(false); | |||
} | |||
public async Task<IReadOnlyCollection<GuildApplicationCommandPermission>> BatchModifyApplicationCommandPermissions(ModifyGuildApplicationCommandPermissions[] permissions, ulong guildId, RequestOptions options = null) | |||
public async Task<IReadOnlyCollection<GuildApplicationCommandPermission>> BatchModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissions[] permissions, ulong guildId, RequestOptions options = null) | |||
{ | |||
Preconditions.NotEqual(guildId, 0, nameof(guildId)); | |||
Preconditions.NotNull(permissions, nameof(permissions)); | |||
@@ -2091,7 +2091,7 @@ namespace Discord.API | |||
return _serializer.Deserialize<T>(reader); | |||
} | |||
protected async Task<T> TrySendApplicationCommand<T>(Task<T> sendTask) | |||
protected async Task<T> TrySendApplicationCommandAsync<T>(Task<T> sendTask) | |||
{ | |||
try | |||
{ | |||
@@ -14,31 +14,31 @@ namespace Discord.Rest | |||
#region InteractionHelper | |||
public static Task DeleteAllGuildCommandsAsync(BaseDiscordClient client, ulong guildId, RequestOptions options = null) | |||
{ | |||
return client.ApiClient.BulkOverwriteGuildApplicationCommands(guildId, new CreateApplicationCommandParams[0], options); | |||
return client.ApiClient.BulkOverwriteGuildApplicationCommandsAsync(guildId, new CreateApplicationCommandParams[0], options); | |||
} | |||
public static Task DeleteAllGlobalCommandsAsync(BaseDiscordClient client, RequestOptions options = null) | |||
{ | |||
return client.ApiClient.BulkOverwriteGlobalApplicationCommands(new CreateApplicationCommandParams[0], options); | |||
return client.ApiClient.BulkOverwriteGlobalApplicationCommandsAsync(new CreateApplicationCommandParams[0], options); | |||
} | |||
public static Task SendInteractionResponse(BaseDiscordClient client, InteractionResponse response, | |||
ulong interactionId, string interactionToken, RequestOptions options = null) | |||
{ | |||
return client.ApiClient.CreateInteractionResponse(response, interactionId, interactionToken, options); | |||
return client.ApiClient.CreateInteractionResponseAsync(response, interactionId, interactionToken, options); | |||
} | |||
public static async Task<RestInteractionMessage> GetOriginalResponseAsync(BaseDiscordClient client, IMessageChannel channel, | |||
IDiscordInteraction interaction, RequestOptions options = null) | |||
{ | |||
var model = await client.ApiClient.GetInteractionResponse(interaction.Token, options).ConfigureAwait(false); | |||
var model = await client.ApiClient.GetInteractionResponseAsync(interaction.Token, options).ConfigureAwait(false); | |||
return RestInteractionMessage.Create(client, model, interaction.Token, channel); | |||
} | |||
public static async Task<RestFollowupMessage> SendFollowupAsync(BaseDiscordClient client, CreateWebhookMessageParams args, | |||
string token, IMessageChannel channel, RequestOptions options = null) | |||
{ | |||
var model = await client.ApiClient.CreateInteractionFollowupMessage(args, token, options).ConfigureAwait(false); | |||
var model = await client.ApiClient.CreateInteractionFollowupMessageAsync(args, token, options).ConfigureAwait(false); | |||
RestFollowupMessage entity = RestFollowupMessage.Create(client, model, token, channel); | |||
return entity; | |||
@@ -123,7 +123,7 @@ namespace Discord.Rest | |||
models.Add(model); | |||
} | |||
return await client.ApiClient.BulkOverwriteGlobalApplicationCommands(models.ToArray(), options).ConfigureAwait(false); | |||
return await client.ApiClient.BulkOverwriteGlobalApplicationCommandsAsync(models.ToArray(), options).ConfigureAwait(false); | |||
} | |||
public static async Task<IReadOnlyCollection<ApplicationCommand>> BulkOverwriteGuildCommands(BaseDiscordClient client, ulong guildId, | |||
@@ -160,7 +160,7 @@ namespace Discord.Rest | |||
models.Add(model); | |||
} | |||
return await client.ApiClient.BulkOverwriteGuildApplicationCommands(guildId, models.ToArray(), options).ConfigureAwait(false); | |||
return await client.ApiClient.BulkOverwriteGuildApplicationCommandsAsync(guildId, models.ToArray(), options).ConfigureAwait(false); | |||
} | |||
private static TArg GetApplicationCommandProperties<TArg>(IApplicationCommand command) | |||
@@ -367,11 +367,11 @@ namespace Discord.Rest | |||
Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() : Optional<API.ActionRowComponent[]>.Unspecified, | |||
}; | |||
return await client.ApiClient.ModifyInteractionFollowupMessage(apiArgs, message.Id, message.Token, options).ConfigureAwait(false); | |||
return await client.ApiClient.ModifyInteractionFollowupMessageAsync(apiArgs, message.Id, message.Token, options).ConfigureAwait(false); | |||
} | |||
public static async Task DeleteFollowupMessage(BaseDiscordClient client, RestFollowupMessage message, RequestOptions options = null) | |||
=> await client.ApiClient.DeleteInteractionFollowupMessage(message.Id, message.Token, options); | |||
=> await client.ApiClient.DeleteInteractionFollowupMessageAsync(message.Id, message.Token, options); | |||
public static async Task<Message> ModifyInteractionResponse(BaseDiscordClient client, string token, Action<MessageProperties> func, | |||
RequestOptions options = null) | |||
@@ -411,18 +411,18 @@ namespace Discord.Rest | |||
Flags = args.Flags | |||
}; | |||
return await client.ApiClient.ModifyInteractionResponse(apiArgs, token, options).ConfigureAwait(false); | |||
return await client.ApiClient.ModifyInteractionResponseAsync(apiArgs, token, options).ConfigureAwait(false); | |||
} | |||
public static async Task DeletedInteractionResponse(BaseDiscordClient client, RestInteractionMessage message, RequestOptions options = null) | |||
=> await client.ApiClient.DeleteInteractionFollowupMessage(message.Id, message.Token, options); | |||
=> await client.ApiClient.DeleteInteractionFollowupMessageAsync(message.Id, message.Token, options); | |||
#endregion | |||
#region Guild permissions | |||
public static async Task<IReadOnlyCollection<GuildApplicationCommandPermission>> GetGuildCommandPermissionsAsync(BaseDiscordClient client, | |||
ulong guildId, RequestOptions options) | |||
{ | |||
var models = await client.ApiClient.GetGuildApplicationCommandPermissions(guildId, options); | |||
var models = await client.ApiClient.GetGuildApplicationCommandPermissionsAsync(guildId, options); | |||
return models.Select(x => | |||
new GuildApplicationCommandPermission(x.Id, x.ApplicationId, guildId, x.Permissions.Select( | |||
y => new Discord.ApplicationCommandPermission(y.Id, y.Type, y.Permission)) | |||
@@ -435,7 +435,7 @@ namespace Discord.Rest | |||
{ | |||
try | |||
{ | |||
var model = await client.ApiClient.GetGuildApplicationCommandPermission(guildId, commandId, options); | |||
var model = await client.ApiClient.GetGuildApplicationCommandPermissionAsync(guildId, commandId, options); | |||
return new GuildApplicationCommandPermission(model.Id, model.ApplicationId, guildId, model.Permissions.Select( | |||
y => new ApplicationCommandPermission(y.Id, y.Type, y.Permission)).ToArray()); | |||
} | |||
@@ -473,7 +473,7 @@ namespace Discord.Rest | |||
Permissions = permissionsList.ToArray() | |||
}; | |||
var apiModel = await client.ApiClient.ModifyApplicationCommandPermissions(model, guildId, commandId, options); | |||
var apiModel = await client.ApiClient.ModifyApplicationCommandPermissionsAsync(model, guildId, commandId, options); | |||
return new GuildApplicationCommandPermission(apiModel.Id, apiModel.ApplicationId, guildId, apiModel.Permissions.Select( | |||
x => new ApplicationCommandPermission(x.Id, x.Type, x.Permission)).ToArray()); | |||
@@ -505,7 +505,7 @@ namespace Discord.Rest | |||
models.Add(model); | |||
} | |||
var apiModels = await client.ApiClient.BatchModifyApplicationCommandPermissions(models.ToArray(), guildId, options); | |||
var apiModels = await client.ApiClient.BatchModifyApplicationCommandPermissionsAsync(models.ToArray(), guildId, options); | |||
return apiModels.Select( | |||
x => new GuildApplicationCommandPermission(x.Id, x.ApplicationId, x.GuildId, x.Permissions.Select( | |||
@@ -97,5 +97,7 @@ namespace Discord.Rest | |||
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object."); | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -1393,29 +1393,6 @@ | |||
</note> | |||
</remarks> | |||
</member> | |||
<member name="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"> | |||
<summary> | |||
Gets or sets whether or not interactions are acknowledge with source. | |||
</summary> | |||
<remarks> | |||
<para> | |||
Discord interactions will not appear in chat until the client responds to them. With this option set to | |||
<see langword="true"/>, the client will automatically acknowledge the interaction with <see cref="F:Discord.InteractionResponseType.DeferredChannelMessageWithSource"/>. | |||
See <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-interactionresponsetype">the docs</see> on | |||
responding to interactions for more info. | |||
</para> | |||
<para> | |||
With this option set to <see langword="false"/>, you will have to acknowledge the interaction with | |||
<see cref="!:SocketInteraction.RespondAsync(string, bool, Embed, InteractionResponseType, AllowedMentions, RequestOptions)"/>. | |||
Only after the interaction is acknowledged, the original slash command message will be visible. | |||
</para> | |||
<note> | |||
Please note that manually acknowledging the interaction with a message reply will not provide any return data. | |||
Automatically acknowledging the interaction without sending the message will allow for follow up responses to | |||
be used; follow up responses return the message data sent. | |||
</note> | |||
</remarks> | |||
</member> | |||
<member name="P:Discord.WebSocket.DiscordSocketConfig.HandlerTimeout"> | |||
<summary> | |||
Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged. | |||
@@ -3572,6 +3549,21 @@ | |||
<member name="M:Discord.WebSocket.SocketGuild.DeleteEmoteAsync(Discord.GuildEmote,Discord.RequestOptions)"> | |||
<inheritdoc /> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketGuild.MoveAsync(Discord.IGuildUser,Discord.IVoiceChannel)"> | |||
<summary> | |||
Moves the user to the voice channel. | |||
</summary> | |||
<param name="user">The user to move.</param> | |||
<param name="targetChannel">the channel where the user gets moved to.</param> | |||
<returns>A task that represents the asynchronous operation for moving a user.</returns> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketGuild.Discord#IGuild#DisconnectAsync(Discord.IGuildUser)"> | |||
<summary> | |||
Disconnects the user from its current voice channel | |||
</summary> | |||
<param name="user">The user to disconnect.</param> | |||
<returns>A task that represents the asynchronous operation for disconnecting a user.</returns> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketGuild.GetStickerAsync(System.UInt64,Discord.CacheMode,Discord.RequestOptions)"> | |||
<summary> | |||
Gets a specific sticker within this guild. | |||
@@ -4189,7 +4181,7 @@ | |||
<summary> | |||
Responds to an Interaction with type <see cref="F:Discord.InteractionResponseType.ChannelMessageWithSource"/>. | |||
<para> | |||
If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | |||
If you have <see cref="!:DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | |||
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"/> instead. | |||
</para> | |||
</summary> | |||
@@ -72,8 +72,6 @@ namespace Discord.WebSocket | |||
internal WebSocketProvider WebSocketProvider { get; private set; } | |||
internal bool AlwaysDownloadUsers { get; private set; } | |||
internal int? HandlerTimeout { get; private set; } | |||
internal bool AlwaysAcknowledgeInteractions { get; private set; } | |||
internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient; | |||
/// <inheritdoc /> | |||
public override IReadOnlyCollection<SocketGuild> Guilds => State.Guilds; | |||
@@ -143,7 +141,6 @@ namespace Discord.WebSocket | |||
UdpSocketProvider = config.UdpSocketProvider; | |||
WebSocketProvider = config.WebSocketProvider; | |||
AlwaysDownloadUsers = config.AlwaysDownloadUsers; | |||
AlwaysAcknowledgeInteractions = config.AlwaysAcknowledgeInteractions; | |||
HandlerTimeout = config.HandlerTimeout; | |||
State = new ClientState(0, 0); | |||
Rest = new DiscordSocketRestClient(config, ApiClient); | |||
@@ -2095,9 +2092,6 @@ namespace Discord.WebSocket | |||
var interaction = SocketInteraction.Create(this, data, channel as ISocketMessageChannel); | |||
if (this.AlwaysAcknowledgeInteractions) | |||
await interaction.DeferAsync().ConfigureAwait(false); | |||
await TimedInvokeAsync(_interactionCreatedEvent, nameof(InteractionCreated), interaction).ConfigureAwait(false); | |||
switch (interaction) | |||
@@ -105,29 +105,6 @@ namespace Discord.WebSocket | |||
/// </remarks> | |||
public bool AlwaysDownloadUsers { get; set; } = false; | |||
/// <summary> | |||
/// Gets or sets whether or not interactions are acknowledge with source. | |||
/// </summary> | |||
/// <remarks> | |||
/// <para> | |||
/// Discord interactions will not appear in chat until the client responds to them. With this option set to | |||
/// <see langword="true"/>, the client will automatically acknowledge the interaction with <see cref="InteractionResponseType.DeferredChannelMessageWithSource"/>. | |||
/// See <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-interactionresponsetype">the docs</see> on | |||
/// responding to interactions for more info. | |||
/// </para> | |||
/// <para> | |||
/// With this option set to <see langword="false"/>, you will have to acknowledge the interaction with | |||
/// <see cref="SocketInteraction.RespondAsync(string, bool, Embed, InteractionResponseType, AllowedMentions, RequestOptions)"/>. | |||
/// Only after the interaction is acknowledged, the original slash command message will be visible. | |||
/// </para> | |||
/// <note> | |||
/// Please note that manually acknowledging the interaction with a message reply will not provide any return data. | |||
/// Automatically acknowledging the interaction without sending the message will allow for follow up responses to | |||
/// be used; follow up responses return the message data sent. | |||
/// </note> | |||
/// </remarks> | |||
public bool AlwaysAcknowledgeInteractions { get; set; } = true; | |||
/// <summary> | |||
/// Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged. | |||
/// Setting this property to <c>null</c>disables this check. | |||
@@ -86,12 +86,6 @@ namespace Discord.WebSocket | |||
if (embeds == null && embed != null) | |||
embeds = new[] { embed }; | |||
if (Discord.AlwaysAcknowledgeInteractions) | |||
{ | |||
await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, options); | |||
return; | |||
} | |||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | |||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | |||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | |||
@@ -341,7 +335,7 @@ namespace Discord.WebSocket | |||
}; | |||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||
return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); | |||
} | |||
/// <inheritdoc/> | |||
@@ -354,7 +348,7 @@ namespace Discord.WebSocket | |||
}; | |||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||
return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); | |||
} | |||
} | |||
} |
@@ -70,12 +70,6 @@ namespace Discord.WebSocket | |||
if (embeds == null && embed != null) | |||
embeds = new[] { embed }; | |||
if (Discord.AlwaysAcknowledgeInteractions) | |||
{ | |||
await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, options, component); | |||
return; | |||
} | |||
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); | |||
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); | |||
Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); | |||
@@ -244,7 +238,7 @@ namespace Discord.WebSocket | |||
} | |||
}; | |||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||
return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); | |||
} | |||
} | |||
} |