BotSharp/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeFunction.cs

15 lines
402 B
C#
Raw Normal View History

2023-12-07 03:06:09 +00:00
using BotSharp.Abstraction.Functions;
namespace BotSharp.Core.Routing;
public partial class RoutingService
{
public async Task<bool> InvokeFunction(string name, RoleDialogModel message)
{
var function = _services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == name);
if (function == null) return false;
return await function.Execute(message);
}
}