util.go 298 B

12345678910111213141516
  1. package discordgo
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. )
  7. func printJSON(body []byte) {
  8. var prettyJSON bytes.Buffer
  9. error := json.Indent(&prettyJSON, body, "", "\t")
  10. if error != nil {
  11. fmt.Print("JSON parse error: ", error)
  12. }
  13. fmt.Println("RESPONSE ::\n" + string(prettyJSON.Bytes()))
  14. }