2023-08-25 15:33:21 +00:00
|
|
|
namespace BotSharp.Core.Hooks;
|
|
|
|
|
|
2023-08-28 03:50:10 +00:00
|
|
|
public class RoutingHook : AgentHookBase
|
2023-08-25 15:33:21 +00:00
|
|
|
{
|
2023-08-28 03:50:10 +00:00
|
|
|
public RoutingHook(IServiceProvider services, AgentSettings settings)
|
2023-08-25 15:33:21 +00:00
|
|
|
: base(services, settings)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool OnInstructionLoaded(string template, Dictionary<string, object> dict)
|
|
|
|
|
{
|
|
|
|
|
var router = _services.GetRequiredService<IAgentRouting>();
|
2023-08-27 11:07:22 +00:00
|
|
|
dict["routing_records"] = router.GetRoutingRecords()
|
|
|
|
|
.Where(x => !x.Disabled)
|
|
|
|
|
.ToList();
|
2023-08-25 15:33:21 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|