From 2ca2363de76e4d37ab611ffeeae4423e35222d36 Mon Sep 17 00:00:00 2001 From: sisi0318 Date: Tue, 8 Oct 2024 13:38:32 +0800 Subject: [PATCH] greytip --- .../Message/Entity/GreyTipSegment.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Lagrange.OneBot/Message/Entity/GreyTipSegment.cs diff --git a/Lagrange.OneBot/Message/Entity/GreyTipSegment.cs b/Lagrange.OneBot/Message/Entity/GreyTipSegment.cs new file mode 100644 index 000000000..6db7e1e21 --- /dev/null +++ b/Lagrange.OneBot/Message/Entity/GreyTipSegment.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using Lagrange.Core.Message; +using Lagrange.Core.Message.Entity; + +namespace Lagrange.OneBot.Message.Entity; + +[Serializable] +public partial class GreyTipSegment(string content) +{ + public GreyTipSegment(): this("") {} + + [JsonPropertyName("content")] [CQProperty] public string Content { get; set; } = content; +} + +[SegmentSubscriber(typeof(GreyTipEntity), "greytip")] +public partial class GreyTipSegment : SegmentBase +{ + public override void Build(MessageBuilder builder, SegmentBase segment) + { + if (segment is GreyTipSegment greyTip) builder.GeryTip(greyTip.Content); + } + + public override SegmentBase? FromEntity(MessageChain chain, IMessageEntity entity) + { + return null; + } +} \ No newline at end of file