util.go 433 B

1234567891011121314151617181920
  1. // this file has small funcs used without the pacakge
  2. // or, one.. util, maybe I'll have more later :)
  3. package discordgo
  4. import (
  5. "bytes"
  6. "encoding/json"
  7. "fmt"
  8. )
  9. // convert to return as string
  10. func printJSON(body []byte) {
  11. var prettyJSON bytes.Buffer
  12. error := json.Indent(&prettyJSON, body, "", "\t")
  13. if error != nil {
  14. fmt.Print("JSON parse error: ", error)
  15. }
  16. fmt.Println("RESPONSE ::\n" + string(prettyJSON.Bytes()))
  17. }