fix(feishu): handle code_block elements in post message parsing (#480)
This commit is contained in:
1 parent
45036a6356
commit
d621cff2a4
1 file changed
+6
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user