BotSharp/src/Plugins/BotSharp.Plugin.Dashboard/Hooks/StatsConversationHook.cs

21 lines
592 B
C#
Raw Normal View History

2024-01-29 04:18:40 +00:00
using BotSharp.Abstraction.Conversations;
using BotSharp.Abstraction.Plugins.Models;
using BotSharp.Abstraction.Repositories;
namespace BotSharp.Plugin.Dashboard.Hooks;
public class StatsConversationHook : ConversationHookBase
{
private readonly IServiceProvider _services;
public StatsConversationHook(IServiceProvider services)
{
_services = services;
}
public override async Task OnConversationInitialized(Conversation conversation)
{
var db = _services.GetRequiredService<IBotSharpRepository>();
db.IncrementConversationCount();
}
}