From fdafbf8c24516b2f8d4e01cb5d8a7d7adc9dd8ed Mon Sep 17 00:00:00 2001 From: "Wesley F. Young" Date: Sat, 11 Jan 2025 17:51:35 +0800 Subject: [PATCH] [Core] Construct ForwardEntity with a single sequence --- Lagrange.Core/Message/Entity/ForwardEntity.cs | 7 +++++++ Lagrange.Core/Message/MessageBuilder.cs | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Lagrange.Core/Message/Entity/ForwardEntity.cs b/Lagrange.Core/Message/Entity/ForwardEntity.cs index 81ca5dfdb..300b9cd85 100644 --- a/Lagrange.Core/Message/Entity/ForwardEntity.cs +++ b/Lagrange.Core/Message/Entity/ForwardEntity.cs @@ -31,6 +31,13 @@ public ForwardEntity() Elements = new List(); } + public ForwardEntity(uint sequence) + { + Sequence = sequence; + Uid = null; + Elements = new List(); + } + public ForwardEntity(MessageChain chain) { Time = chain.Time; diff --git a/Lagrange.Core/Message/MessageBuilder.cs b/Lagrange.Core/Message/MessageBuilder.cs index f1acefd29..2ce88825e 100644 --- a/Lagrange.Core/Message/MessageBuilder.cs +++ b/Lagrange.Core/Message/MessageBuilder.cs @@ -121,6 +121,18 @@ public MessageBuilder Forward(MessageChain target) return this; } + + /// + /// Add a forward entity to the specified message sequence number + /// + /// The sequence number of the message to be forwarded + public MessageBuilder Forward(uint sequence) + { + var forwardEntity = new ForwardEntity(sequence); + _chain.Add(forwardEntity); + + return this; + } /// /// Add a multimsg entity to the message chain (multi message)