From 114221f32a03a799bca096abea6196276f981e91 Mon Sep 17 00:00:00 2001 From: Cenngo Date: Sun, 6 Mar 2022 12:55:23 +0300 Subject: [PATCH] fix build errors --- .../Info/Commands/SlashCommandInfo.cs | 2 +- src/Discord.Net.Interactions/InteractionService.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Interactions/Info/Commands/SlashCommandInfo.cs b/src/Discord.Net.Interactions/Info/Commands/SlashCommandInfo.cs index 1682da0bc..a123ac183 100644 --- a/src/Discord.Net.Interactions/Info/Commands/SlashCommandInfo.cs +++ b/src/Discord.Net.Interactions/Info/Commands/SlashCommandInfo.cs @@ -88,7 +88,7 @@ namespace Discord.Interactions } return await RunAsync(context, args, services).ConfigureAwait(false); } - else + catch(Exception ex) { return await InvokeEventAndReturn(context, ExecuteResult.FromError(ex)).ConfigureAwait(false); } diff --git a/src/Discord.Net.Interactions/InteractionService.cs b/src/Discord.Net.Interactions/InteractionService.cs index 8cf3a8730..b7e92998b 100644 --- a/src/Discord.Net.Interactions/InteractionService.cs +++ b/src/Discord.Net.Interactions/InteractionService.cs @@ -785,6 +785,20 @@ namespace Discord.Interactions return await commandResult.Command.ExecuteAsync(context, services).ConfigureAwait(false); } + private async Task ExecuteModalCommandAsync(IInteractionContext context, string input, IServiceProvider services) + { + var result = _modalCommandMap.GetCommand(input); + + if (!result.IsSuccess) + { + await _cmdLogger.DebugAsync($"Unknown custom interaction id, skipping execution ({input.ToUpper()})"); + + await _componentCommandExecutedEvent.InvokeAsync(null, context, result).ConfigureAwait(false); + return result; + } + return await result.Command.ExecuteAsync(context, services, result.RegexCaptureGroups).ConfigureAwait(false); + } + internal TypeConverter GetTypeConverter(Type type, IServiceProvider services = null) => _typeConverterMap.Get(type, services);