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

16 lines
439 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;
2023-12-11 23:15:37 +00:00
message.FunctionName = name;
2023-12-07 03:06:09 +00:00
return await function.Execute(message);
}
}