using Furion.Logging;
using Microsoft.AspNetCore.Mvc;
using NapCatRobotClient.Service.Dispatcher.Service;
namespace NapCatRobotClient.API.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class EntryController : ControllerBase
{
private readonly IDispatcherService _dispatcherService;
public EntryController(IDispatcherService dispatcherService)
{
_dispatcherService = dispatcherService;
}
///
/// 接收消息入口
///
///
[HttpPost]
public async Task Post()
{
using StreamReader reader = new(Request.Body);
string body = await reader.ReadToEndAsync();
Log.Information($"接收到群消息:{body}");
bool result = await _dispatcherService.ReceiveMessageAndProcess(body);
return Ok(result);
}
}
}