From a7449484772733d8bc122321ddebbd52e98b1b53 Mon Sep 17 00:00:00 2001 From: Armano den Boef <68127614+Rozen4334@users.noreply.github.com> Date: Mon, 4 Apr 2022 23:14:36 +0200 Subject: [PATCH] feature: Global interaction post execution event. (#2213) * Init * Variable set to event * Put internal above private * Revert "Put internal above private" This reverts commit 77784f001faa58a90edf34edc195d6942ba9b451. * Revert "Variable set to event" This reverts commit 2b0cb81d76e2150a8d692028486aa1d402efe8a3. * Revert "Init" This reverts commit 9892ce7b51d8cf2952d4ae5b67f4a2e4c7917ae2. * Potentially improved approach --- .../InteractionService.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Discord.Net.Interactions/InteractionService.cs b/src/Discord.Net.Interactions/InteractionService.cs index deb6fa931..01fb8cc9d 100644 --- a/src/Discord.Net.Interactions/InteractionService.cs +++ b/src/Discord.Net.Interactions/InteractionService.cs @@ -24,6 +24,29 @@ namespace Discord.Interactions public event Func Log { add { _logEvent.Add(value); } remove { _logEvent.Remove(value); } } internal readonly AsyncEvent> _logEvent = new (); + /// + /// Occurs when any type of interaction is executed. + /// + public event Func InteractionExecuted + { + add + { + SlashCommandExecuted += value; + ContextCommandExecuted += value; + ComponentCommandExecuted += value; + AutocompleteCommandExecuted += value; + ModalCommandExecuted += value; + } + remove + { + SlashCommandExecuted -= value; + ContextCommandExecuted -= value; + ComponentCommandExecuted -= value; + AutocompleteCommandExecuted -= value; + ModalCommandExecuted -= value; + } + } + /// /// Occurs when a Slash Command is executed. ///