BotSharp/src/Plugins/BotSharp.Plugin.AudioHandler/Hooks/AudioHandlerHook.cs

32 lines
839 B
C#
Raw Normal View History

2024-08-17 03:39:32 +00:00
using BotSharp.Abstraction.Agents.Settings;
2024-08-26 22:24:07 +00:00
namespace BotSharp.Plugin.AudioHandler.Hooks;
public class AudioHandlerHook : AgentHookBase, IAgentHook
2024-08-17 03:39:32 +00:00
{
2024-08-26 22:24:07 +00:00
private const string HANDLER_AUDIO = "handle_audio_request";
public override string SelfId => string.Empty;
2024-11-20 08:24:26 +00:00
public AudioHandlerHook(IServiceProvider services, AgentSettings settings)
: base(services, settings)
2024-08-17 03:39:32 +00:00
{
2024-08-26 22:24:07 +00:00
}
2024-08-17 03:39:32 +00:00
2024-08-26 22:24:07 +00:00
public override void OnAgentLoaded(Agent agent)
{
2024-11-20 16:13:40 +00:00
var utilityLoad = new AgentUtility
2024-08-17 03:39:32 +00:00
{
2024-11-20 16:13:40 +00:00
Name = UtilityName.AudioHandler,
2024-11-20 08:24:26 +00:00
Content = new UtilityContent
2024-08-17 03:39:32 +00:00
{
2024-11-20 08:24:26 +00:00
Functions = [new(HANDLER_AUDIO)],
Templates = [new($"{HANDLER_AUDIO}.fn")]
2024-08-26 22:24:07 +00:00
}
2024-11-20 08:24:26 +00:00
};
2024-08-17 03:39:32 +00:00
2024-11-20 08:24:26 +00:00
base.OnLoadAgentUtility(agent, [utilityLoad]);
base.OnAgentLoaded(agent);
2024-08-17 03:39:32 +00:00
}
}