@@ -469,7 +469,7 @@ namespace Discord.WebSocket | |||||
#region Interactions | #region Interactions | ||||
/// <summary> | /// <summary> | ||||
/// Fired when an Interaction is created. This event covers all types of interactions including but not limited to: buttons, select menus, slash commands. | |||||
/// Fired when an Interaction is created. This event covers all types of interactions including but not limited to: buttons, select menus, slash commands, autocompletes. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// <para> | /// <para> | ||||
@@ -535,6 +535,15 @@ namespace Discord.WebSocket | |||||
remove => _messageCommandExecuted.Remove(value); | remove => _messageCommandExecuted.Remove(value); | ||||
} | } | ||||
internal readonly AsyncEvent<Func<SocketMessageCommand, Task>> _messageCommandExecuted = new AsyncEvent<Func<SocketMessageCommand, Task>>(); | internal readonly AsyncEvent<Func<SocketMessageCommand, Task>> _messageCommandExecuted = new AsyncEvent<Func<SocketMessageCommand, Task>>(); | ||||
/// <summary> | |||||
/// Fired when an autocomplete is used and its interaction is received. | |||||
/// </summary> | |||||
public event Func<SocketAutocompleteInteraction, Task> AutocompleteExecuted | |||||
{ | |||||
add => _autocompleteExecuted.Add(value); | |||||
remove => _autocompleteExecuted.Remove(value); | |||||
} | |||||
internal readonly AsyncEvent<Func<SocketAutocompleteInteraction, Task>> _autocompleteExecuted = new AsyncEvent<Func<SocketAutocompleteInteraction, Task>>(); | |||||
/// <summary> | /// <summary> | ||||
/// Fired when a guild application command is created. | /// Fired when a guild application command is created. | ||||
@@ -746,6 +746,11 @@ | |||||
Fired when a message command is used and its interaction is received. | Fired when a message command is used and its interaction is received. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="E:Discord.WebSocket.BaseSocketClient.AutocompleteExecuted"> | |||||
<summary> | |||||
Fired when an autocomplete is used and its interaction is received. | |||||
</summary> | |||||
</member> | |||||
<member name="E:Discord.WebSocket.BaseSocketClient.ApplicationCommandCreated"> | <member name="E:Discord.WebSocket.BaseSocketClient.ApplicationCommandCreated"> | ||||
<summary> | <summary> | ||||
Fired when a guild application command is created. | Fired when a guild application command is created. | ||||
@@ -466,6 +466,7 @@ namespace Discord.WebSocket | |||||
client.SlashCommandExecuted += (arg) => _slashCommandExecuted.InvokeAsync(arg); | client.SlashCommandExecuted += (arg) => _slashCommandExecuted.InvokeAsync(arg); | ||||
client.UserCommandExecuted += (arg) => _userCommandExecuted.InvokeAsync(arg); | client.UserCommandExecuted += (arg) => _userCommandExecuted.InvokeAsync(arg); | ||||
client.MessageCommandExecuted += (arg) => _messageCommandExecuted.InvokeAsync(arg); | client.MessageCommandExecuted += (arg) => _messageCommandExecuted.InvokeAsync(arg); | ||||
client.AutocompleteExecuted += (arg) => _autocompleteExecuted.InvokeAsync(arg); | |||||
client.ThreadUpdated += (thread1, thread2) => _threadUpdated.InvokeAsync(thread1, thread2); | client.ThreadUpdated += (thread1, thread2) => _threadUpdated.InvokeAsync(thread1, thread2); | ||||
client.ThreadCreated += (thread) => _threadCreated.InvokeAsync(thread); | client.ThreadCreated += (thread) => _threadCreated.InvokeAsync(thread); | ||||
@@ -2125,6 +2125,9 @@ namespace Discord.WebSocket | |||||
case SocketMessageCommand messageCommand: | case SocketMessageCommand messageCommand: | ||||
await TimedInvokeAsync(_messageCommandExecuted, nameof(MessageCommandExecuted), messageCommand).ConfigureAwait(false); | await TimedInvokeAsync(_messageCommandExecuted, nameof(MessageCommandExecuted), messageCommand).ConfigureAwait(false); | ||||
break; | break; | ||||
case SocketAutocompleteInteraction autocomplete: | |||||
await TimedInvokeAsync(_autocompleteExecuted, nameof(AutocompleteExecuted), autocomplete).ConfigureAwait(false); | |||||
break; | |||||
} | } | ||||
} | } | ||||
else | else | ||||