diff --git a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs index 961a819f7..99895d3ed 100644 --- a/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs @@ -110,11 +110,10 @@ namespace Discord.Interactions { await CommandService._cmdLogger.DebugAsync($"Executing {GetLogString(context)}").ConfigureAwait(false); + using var scope = services?.CreateScope(); + if (CommandService._autoServiceScopes) - { - using var scope = services?.CreateScope(); services = scope?.ServiceProvider ?? EmptyServiceProvider.Instance; - } try { diff --git a/src/Discord.Net.Interactions/Info/Commands/ContextCommands/MessageCommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/ContextCommands/MessageCommandInfo.cs index 09dd56340..76eda2cf6 100644 --- a/src/Discord.Net.Interactions/Info/Commands/ContextCommands/MessageCommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/ContextCommands/MessageCommandInfo.cs @@ -17,7 +17,7 @@ namespace Discord.Interactions if (context.Interaction is not IMessageCommandInteraction) return ExecuteResult.FromError(InteractionCommandError.ParseFailed, $"Provided {nameof(IInteractionContext)} doesn't belong to a Message Command Interation"); - return await ExecuteAsync(context, services).ConfigureAwait(false); + return await base.ExecuteAsync(context, services).ConfigureAwait(false); } protected override Task ParseArgumentsAsync(IInteractionContext context, IServiceProvider services) diff --git a/src/Discord.Net.Interactions/Info/Commands/ContextCommands/UserCommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/ContextCommands/UserCommandInfo.cs index 22acf9056..a26f3f560 100644 --- a/src/Discord.Net.Interactions/Info/Commands/ContextCommands/UserCommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/ContextCommands/UserCommandInfo.cs @@ -17,7 +17,7 @@ namespace Discord.Interactions if (context.Interaction is not IUserCommandInteraction userCommand) return ExecuteResult.FromError(InteractionCommandError.ParseFailed, $"Provided {nameof(IInteractionContext)} doesn't belong to a Message Command Interation"); - return await ExecuteAsync(context, services).ConfigureAwait(false); + return await base.ExecuteAsync(context, services).ConfigureAwait(false); } protected override Task ParseArgumentsAsync(IInteractionContext context, IServiceProvider services)