Skip to content

Commit

Permalink
[OneBot] Fixed Type of MessageId in ReplySegment.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Feb 11, 2024
1 parent 7679845 commit c5a53a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lagrange.OneBot/Core/Message/Entity/ReplySegment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class ReplySegment(uint messageId)
{
public ReplySegment() : this(0) { }

[JsonPropertyName("id")] [CQProperty] public uint MessageId { get; set; } = messageId;
[JsonPropertyName("id")] [CQProperty] public string MessageId { get; set; } = messageId.ToString();
}

[SegmentSubscriber(typeof(ForwardEntity), "reply")]
Expand All @@ -25,7 +25,7 @@ public override void Build(MessageBuilder builder, SegmentBase segment)
{
if (segment is ReplySegment reply && Database is not null)
{
reply.TargetChain ??= (MessageChain)Database.GetCollection<MessageRecord>().FindOne(x => x.MessageHash == reply.MessageId);
reply.TargetChain ??= (MessageChain)Database.GetCollection<MessageRecord>().FindOne(x => x.MessageHash == uint.Parse(reply.MessageId));
builder.Forward(reply.TargetChain);
}
}
Expand All @@ -41,7 +41,7 @@ public override SegmentBase FromEntity(MessageChain chain, IMessageEntity entity

return new ReplySegment
{
MessageId = target.MessageHash
MessageId = target.MessageHash.ToString()
};
}
}

0 comments on commit c5a53a9

Please sign in to comment.