initial commit

This commit is contained in:
basil 2025-06-02 13:18:10 -04:00
commit 313bd35b23
Signed by: basil
SSH key fingerprint: SHA256:y04xIFL/yqNaG9ae9Vl95vELtHfApGAIoOGLeVLP/fE
8 changed files with 591 additions and 0 deletions

34
http.go Normal file
View file

@ -0,0 +1,34 @@
package discord
import (
"bytes"
"encoding/json"
"net/http"
)
type Identifiable interface {
BucketID() string
}
func requestWithToken(
token string,
client *http.Client,
method, url string,
body any,
) (*http.Response, error) {
buf := &bytes.Buffer{}
err := json.NewEncoder(buf).Encode(body)
if err != nil {
return nil, err
}
req, err := http.NewRequest(method, url, buf)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bot "+token)
req.Header.Set("Content-Type", "application/json")
return http.DefaultClient.Do(req)
}