BotSharp/src/Plugins/BotSharp.Plugin.AudioHandler/Hooks/AudioHandlerHook.cs
Jicheng Lu 99dd39d9ba rename
2024-11-20 10:13:40 -06:00

32 lines
839 B
C#

using BotSharp.Abstraction.Agents.Settings;
namespace BotSharp.Plugin.AudioHandler.Hooks;
public class AudioHandlerHook : AgentHookBase, IAgentHook
{
private const string HANDLER_AUDIO = "handle_audio_request";
public override string SelfId => string.Empty;
public AudioHandlerHook(IServiceProvider services, AgentSettings settings)
: base(services, settings)
{
}
public override void OnAgentLoaded(Agent agent)
{
var utilityLoad = new AgentUtility
{
Name = UtilityName.AudioHandler,
Content = new UtilityContent
{
Functions = [new(HANDLER_AUDIO)],
Templates = [new($"{HANDLER_AUDIO}.fn")]
}
};
base.OnLoadAgentUtility(agent, [utilityLoad]);
base.OnAgentLoaded(agent);
}
}