diff --git a/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs b/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
index 1ed489aa5..1cd35768d 100644
--- a/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
+++ b/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
@@ -457,7 +457,7 @@ namespace Discord.WebSocket
//Interactions
///
- /// Fired when an Interaction is created.
+ /// Fired when an Interaction is created. This event covers all types of interactions including but not limited to: buttons, select menus, slash commands.
///
///
///
@@ -475,6 +475,55 @@ namespace Discord.WebSocket
}
internal readonly AsyncEvent> _interactionCreatedEvent = new AsyncEvent>();
+ ///
+ /// Fired when a button is clicked and its interaction is received.
+ ///
+ public event Func ButtonExecuted
+ {
+ add => _buttonExecuted.Add(value);
+ remove => _buttonExecuted.Remove(value);
+ }
+ internal readonly AsyncEvent> _buttonExecuted = new AsyncEvent>();
+
+ ///
+ /// Fired when a select menu is used and its interaction is received.
+ ///
+ public event Func SelectMenuExecuted
+ {
+ add => _selectMenuExecuted.Add(value);
+ remove => _selectMenuExecuted.Remove(value);
+ }
+ internal readonly AsyncEvent> _selectMenuExecuted = new AsyncEvent>();
+ ///
+ /// Fired when a slash command is used and its interaction is received.
+ ///
+ public event Func SlashCommandExecuted
+ {
+ add => _slashCommandExecuted.Add(value);
+ remove => _slashCommandExecuted.Remove(value);
+ }
+ internal readonly AsyncEvent> _slashCommandExecuted = new AsyncEvent>();
+
+ ///
+ /// Fired when a user command is used and its interaction is received.
+ ///
+ public event Func UserCommandExecuted
+ {
+ add => _userCommandExecuted.Add(value);
+ remove => _userCommandExecuted.Remove(value);
+ }
+ internal readonly AsyncEvent> _userCommandExecuted = new AsyncEvent>();
+
+ ///
+ /// Fired when a message command is used and its interaction is received.
+ ///
+ public event Func MessageCommandExecuted
+ {
+ add => _messageCommandExecuted.Add(value);
+ remove => _messageCommandExecuted.Remove(value);
+ }
+ internal readonly AsyncEvent> _messageCommandExecuted = new AsyncEvent>();
+
///
/// Fired when a guild application command is created.
///
diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
index d6f7e78c1..ba30f85d4 100644
--- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
+++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
@@ -709,7 +709,7 @@
- Fired when an Interaction is created.
+ Fired when an Interaction is created. This event covers all types of interactions including but not limited to: buttons, select menus, slash commands.
@@ -721,6 +721,31 @@
+
+
+ Fired when a button is clicked and its interaction is received.
+
+
+
+
+ Fired when a select menu is used and its interaction is received.
+
+
+
+
+ Fired when a slash command is used and its interaction is received.
+
+
+
+
+ Fired when a user command is used and its interaction is received.
+
+
+
+
+ Fired when a message command is used and its interaction is received.
+
+
Fired when a guild application command is created.
diff --git a/src/Discord.Net.WebSocket/DiscordShardedClient.cs b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
index 0d9b4ad1a..4b67322a3 100644
--- a/src/Discord.Net.WebSocket/DiscordShardedClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
@@ -456,6 +456,11 @@ namespace Discord.WebSocket
client.InviteDeleted += (channel, invite) => _inviteDeletedEvent.InvokeAsync(channel, invite);
client.InteractionCreated += (interaction) => _interactionCreatedEvent.InvokeAsync(interaction);
+ client.ButtonExecuted += (arg) => _buttonExecuted.InvokeAsync(arg);
+ client.SelectMenuExecuted += (arg) => _selectMenuExecuted.InvokeAsync(arg);
+ client.SlashCommandExecuted += (arg) => _slashCommandExecuted.InvokeAsync(arg);
+ client.UserCommandExecuted += (arg) => _userCommandExecuted.InvokeAsync(arg);
+ client.MessageCommandExecuted += (arg) => _messageCommandExecuted.InvokeAsync(arg);
client.ThreadUpdated += (thread1, thread2) => _threadUpdated.InvokeAsync(thread1, thread2);
client.ThreadCreated += (thread) => _threadCreated.InvokeAsync(thread);
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index 1eb034434..ced0f80e7 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -2090,6 +2090,25 @@ namespace Discord.WebSocket
await interaction.DeferAsync().ConfigureAwait(false);
await TimedInvokeAsync(_interactionCreatedEvent, nameof(InteractionCreated), interaction).ConfigureAwait(false);
+
+ switch (interaction)
+ {
+ case SocketSlashCommand slashCommand:
+ await TimedInvokeAsync(_slashCommandExecuted, nameof(SlashCommandExecuted), slashCommand).ConfigureAwait(false);
+ break;
+ case SocketMessageComponent messageComponent:
+ if(messageComponent.Data.Type == ComponentType.SelectMenu)
+ await TimedInvokeAsync(_selectMenuExecuted, nameof(SelectMenuExecuted), messageComponent).ConfigureAwait(false);
+ if(messageComponent.Data.Type == ComponentType.Button)
+ await TimedInvokeAsync(_buttonExecuted, nameof(ButtonExecuted), messageComponent).ConfigureAwait(false);
+ break;
+ case SocketUserCommand userCommand:
+ await TimedInvokeAsync(_userCommandExecuted, nameof(UserCommandExecuted), userCommand).ConfigureAwait(false);
+ break;
+ case SocketMessageCommand messageCommand:
+ await TimedInvokeAsync(_messageCommandExecuted, nameof(MessageCommandExecuted), messageCommand).ConfigureAwait(false);
+ break;
+ }
}
else
{