From d621cff2a4e14ea94a3aa9741f43f8135bc5bbd8 Mon Sep 17 00:00:00 2001 From: Entrenador Date: Wed, 8 Apr 2026 07:26:10 -0700 Subject: [PATCH] fix(feishu): handle code_block elements in post message parsing (#480) --- platform/feishu/feishu.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/feishu/feishu.go b/platform/feishu/feishu.go index bec3e13..f6907cd 100644 --- a/platform/feishu/feishu.go +++ b/platform/feishu/feishu.go @@ -2803,6 +2803,7 @@ func (p *Platform) SendAudio(ctx context.Context, rctx any, audio []byte, format type postElement struct { Tag string `json:"tag"` Text string `json:"text,omitempty"` + Language string `json:"language,omitempty"` ImageKey string `json:"image_key,omitempty"` Href string `json:"href,omitempty"` } @@ -2849,6 +2850,11 @@ func (p *Platform) extractPostParts(messageID string, post *postLang) ([]string, if elem.Text != "" { textParts = append(textParts, elem.Text) } + case "code_block": + if elem.Text != "" { + lang := elem.Language + textParts = append(textParts, "```"+lang+"\n"+elem.Text+"\n```") + } case "img": if elem.ImageKey != "" { imgData, mimeType, err := p.downloadImage(messageID, elem.ImageKey)