From 05d793ef13e9343533dc98e2006089d223d7ef5f Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Sat, 4 Jan 2025 12:58:11 +0800 Subject: [PATCH] [OneBot] adjust SendGroupAiRecordOperation (#727) --- .../Message/SendGroupAiRecordOperation.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Lagrange.OneBot/Core/Operation/Message/SendGroupAiRecordOperation.cs b/Lagrange.OneBot/Core/Operation/Message/SendGroupAiRecordOperation.cs index 858734ced..618ae4620 100644 --- a/Lagrange.OneBot/Core/Operation/Message/SendGroupAiRecordOperation.cs +++ b/Lagrange.OneBot/Core/Operation/Message/SendGroupAiRecordOperation.cs @@ -11,7 +11,7 @@ namespace Lagrange.OneBot.Core.Operation.Message; [Operation("send_group_ai_record")] -public class GetAiRecordOperation : IOperation +public class SendGroupAiRecordOperation : IOperation { public async Task HandleOperation(BotContext context, JsonNode? payload) { @@ -24,17 +24,9 @@ public async Task HandleOperation(BotContext context, JsonNode? pa message.Text, message.ChatType ); - if (code != 0 || recordEntity == null) return new OneBotResult(null, code, "failed"); - - var chain = MessageBuilder.Group(message.GroupId).Add(recordEntity).Build(); - var result = await context.SendMessage(chain); - - if (result.Result != 0) return new OneBotResult(null, (int)result.Result, "failed"); - if (result.Sequence == null || result.Sequence == 0) return new OneBotResult(null, 9000, "failed"); - - int hash = MessageRecord.CalcMessageHash(chain.MessageId, result.Sequence ?? 0); - - return new OneBotResult(new OneBotMessageResponse(hash), (int)result.Result, "ok"); + return recordEntity != null && code == 0 + ? new OneBotResult(new OneBotMessageResponse(0), code, "ok") + : new OneBotResult(null, code, "failed"); } throw new Exception();