MCPcopy Create free account
hub / github.com/EBWi11/AgentSmith-HUB / formatMapToReadableString

Function formatMapToReadableString

config/plugin/pushMsgToDiscord.go:15–25  ·  view source on GitHub ↗

formatMapToReadableString converts map into a formatted JSON string

(data map[string]interface{})

Source from the content-addressed store, hash-verified

13
14// formatMapToReadableString converts map into a formatted JSON string
15func formatMapToReadableString(data map[string]interface{}) string {
16 if data == nil {
17 return "{}"
18 }
19 b, err := json.MarshalIndent(data, "", " ")
20 if err != nil {
21 flat, _ := json.Marshal(data)
22 return string(flat)
23 }
24 return string(b)
25}
26
27// Eval sends a map payload to a Discord channel via Webhook.
28// Param1: WebhookURL (required)

Callers 1

EvalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected