BotSharp/src/Infrastructure/BotSharp.OpenAPI/Controllers/PluginController.cs

26 lines
624 B
C#
Raw Normal View History

2023-10-11 04:11:06 +00:00
using BotSharp.Abstraction.Plugins.Models;
using BotSharp.Core.Plugins;
namespace BotSharp.OpenAPI.Controllers;
[Authorize]
[ApiController]
public class PluginController : ControllerBase
{
private readonly IServiceProvider _services;
private readonly PluginSettings _settings;
public PluginController(IServiceProvider services, PluginSettings settings)
{
_services = services;
_settings = settings;
}
[HttpGet("/plugins")]
public List<PluginDef> GetPlugins()
{
var loader = _services.GetRequiredService<PluginLoader>();
return loader.GetPlugins();
}
}