Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import (
"fmt
"net/http"
"bytes"
)
type statsForm struct {
ServerCount int `json:"server_count"`
}
var (
stats statsForm
clientId string
authToken string
)
func stats() {
body, err := json.Marshal(&stats)
if err != nil {
fmt.Println("Oh no! An error!", err);
return;
}
client := &http.Client{}
req, err := http.NewRequest("POST", "https://bots.discord.pw/api/bots/" + clientId + "/stats", bytes.NewBuffer(body))
if err != nil {
fmt.Println("Oh no! An error!", err);
return;
}
req.Header.set("Content-Type", "application/json")
req.Header.Set("Authorization", authToken)
_, err = client.Do(req)
if err != nil {
fmt.Println("Oh no! An error!", err);
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment