Start with discord integration

This commit is contained in:
2023-07-02 19:10:14 -04:00
commit 31b17be2ca
10 changed files with 370 additions and 0 deletions

39
pkg/discord/client.go Normal file
View File

@@ -0,0 +1,39 @@
package discord
import (
"context"
"io"
"net/http"
"golang.org/x/oauth2"
)
type ChannelInfo struct{}
type DiscordClient struct {
client *http.Client
defaultChannel string
baseUrl string
apiVersion string
}
func NewClient(ctx context.Context, tokenSrc oauth2.TokenSource) DiscordClient {
return DiscordClient{
client: oauth2.NewClient(ctx, tokenSrc),
baseUrl: "https://discord.com",
apiVersion: "v10",
}
}
func (dc DiscordClient) WithDefaultChannel(channelID string) DiscordClient {
dc.defaultChannel = channelID
return dc
}
func (dc DiscordClient) GetChannel() ChannelInfo {
return ChannelInfo{}
}
func (dc DiscordClient) doRequest(path string, method string, body io.Reader) (*http.Response, error) {
return dc.client.Do(method, path, body)
}