feat:第一次提交
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using NapCatRobotClient.Service.Group.Service;
|
||||
|
||||
namespace NapCatRobotClient.Service.Dispatcher.Service
|
||||
{
|
||||
public class DispatcherService : IDispatcherService, IScoped
|
||||
{
|
||||
|
||||
private readonly IGroupService _groupService;
|
||||
public DispatcherService(IGroupService groupService)
|
||||
{
|
||||
_groupService = groupService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 接收消息并处理
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ReceiveMessageAndProcess(string message)
|
||||
{
|
||||
JObject json = JObject.Parse(message);
|
||||
if (string.IsNullOrWhiteSpace(json["group_id"]?.ToString()) is false)
|
||||
{
|
||||
await _groupService.ProcessGroupRequest(message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace NapCatRobotClient.Service.Dispatcher.Service
|
||||
{
|
||||
public interface IDispatcherService
|
||||
{
|
||||
/// <summary>
|
||||
/// 接收消息并处理
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public Task<bool> ReceiveMessageAndProcess(string message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user