From 36b8bb009752fe9e4e76f7076f97a82e1b370b14 Mon Sep 17 00:00:00 2001 From: Cenngo Date: Tue, 31 May 2022 01:06:36 +0300 Subject: [PATCH] fix implementation bugs --- src/Discord.Net.Interactions/Info/Commands/CommandInfo.cs | 5 ++--- .../Info/Commands/ContextCommands/MessageCommandInfo.cs | 2 +- .../Info/Commands/ContextCommands/UserCommandInfo.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) 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)