()
| 246 | } |
| 247 | |
| 248 | func (m *Message) StringContent() string { |
| 249 | switch m.Content.(type) { |
| 250 | case string: |
| 251 | return m.Content.(string) |
| 252 | case []any: |
| 253 | var contentStr string |
| 254 | for _, contentItem := range m.Content.([]any) { |
| 255 | contentMap, ok := contentItem.(map[string]any) |
| 256 | if !ok { |
| 257 | continue |
| 258 | } |
| 259 | if contentMap["type"] == ContentTypeText { |
| 260 | if subStr, ok := contentMap["text"].(string); ok { |
| 261 | contentStr += subStr |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | return contentStr |
| 266 | } |
| 267 | |
| 268 | return "" |
| 269 | } |
| 270 | |
| 271 | func (m *Message) SetNullContent() { |
| 272 | m.Content = nil |
no outgoing calls
no test coverage detected