From 68698171844cb9e49ccfc883d9f3045ba80b5956 Mon Sep 17 00:00:00 2001
From: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
Date: Tue, 22 Nov 2022 14:05:26 +0300
Subject: [PATCH] Command execution code rework and TypeConverters auto-scope
fix (#2306)
* command execution rework and sync service scopes for typeconverters
* replace ValueTask with Task
* fix implementation bugs
Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
---
.../Info/Commands/AutocompleteCommandInfo.cs | 7 +-
.../Info/Commands/CommandInfo.cs | 124 +++++++++++----------
.../Info/Commands/ComponentCommandInfo.cs | 40 ++-----
.../Commands/ContextCommands/ContextCommandInfo.cs | 2 +-
.../Commands/ContextCommands/MessageCommandInfo.cs | 13 ++-
.../Commands/ContextCommands/UserCommandInfo.cs | 11 +-
.../Info/Commands/ModalCommandInfo.cs | 37 +++---
.../Info/Commands/SlashCommandInfo.cs | 75 ++++++-------
src/Discord.Net.Interactions/Info/ModalInfo.cs | 6 +-
src/Discord.Net.Interactions/InteractionService.cs | 4 +-
.../Results/ParseResult.cs | 12 +-
11 files changed, 159 insertions(+), 172 deletions(-)
diff --git a/src/Discord.Net.Interactions/Info/Commands/AutocompleteCommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/AutocompleteCommandInfo.cs
index 9e30c55f4..b8940f42f 100644
--- a/src/Discord.Net.Interactions/Info/Commands/AutocompleteCommandInfo.cs
+++ b/src/Discord.Net.Interactions/Info/Commands/AutocompleteCommandInfo.cs
@@ -23,7 +23,7 @@ namespace Discord.Interactions
public string CommandName { get; }
///
- public override IReadOnlyCollection Parameters { get; }
+ public override IReadOnlyList Parameters { get; }
///
public override bool SupportsWildCards => false;
@@ -41,9 +41,12 @@ namespace Discord.Interactions
if (context.Interaction is not IAutocompleteInteraction)
return ExecuteResult.FromError(InteractionCommandError.ParseFailed, $"Provided {nameof(IInteractionContext)} doesn't belong to a Autocomplete Interaction");
- return await RunAsync(context, Array.Empty