You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
865 B
C#
30 lines
865 B
C#
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;
|
|
}
|
|
}
|
|
}
|