Skip to content

Commit

Permalink
qwq
Browse files Browse the repository at this point in the history
  • Loading branch information
sisi0318 committed Jan 12, 2025
1 parent abc5b6b commit af5f4ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonNode? pa
TargetUin = chain.FriendUin
});

return new OneBotResult(new OneBotMessageResponse(hash), 0, "ok");
return new OneBotResult(new OneBotMessageResponse(hash,(int)result.Sequence.GetValueOrDefault()), 0, "ok");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
using Lagrange.OneBot.Core.Entity.Message;
using Lagrange.OneBot.Core.Operation.Converters;
using Lagrange.OneBot.Message;

using Lagrange.OneBot.Database;
using Lagrange.OneBot.Core.Entity.Action.Response;
namespace Lagrange.OneBot.Core.Operation.Message;

[Operation("send_msg_with_group_seq")]
public class SendMessageWithGroupSeqOperation(MessageService message) : IOperation
public class SendMessageWithGroupSeqOperation() : IOperation
{
public async Task<OneBotResult> HandleOperation(BotContext context, JsonNode? payload)
{
Expand All @@ -21,10 +22,13 @@ public async Task<OneBotResult> HandleOperation(BotContext context, JsonNode? pa
{
var newMessageChain = new MessageChain(history.TargetGroupId);
var sendMsgRes = await context.SendMessage(newMessageChain, results.Item2?[0] ?? throw new Exception("No PushMsgBody found"));
return new OneBotResult("www", (int)sendMsgRes.Result, "ok");

if (sendMsgRes.Result != 0) return new OneBotResult(null, (int)sendMsgRes.Result, "failed");
if (sendMsgRes.Sequence == null || sendMsgRes.Sequence == 0) return new OneBotResult(null, 9000, "failed");
int hash = MessageRecord.CalcMessageHash(newMessageChain.MessageId, sendMsgRes.Sequence ?? 0);
return new OneBotResult(new OneBotMessageResponse(hash, (int)sendMsgRes.Sequence.GetValueOrDefault()), (int)sendMsgRes.Result, "ok");
}
}

throw new Exception();
}
}

0 comments on commit af5f4ef

Please sign in to comment.