forked from dnsge/twitch-eventsub-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
31 lines (26 loc) · 775 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"context"
"fmt"
esf "github.com/twirapp/twitch-eventsub-framework"
"github.com/twirapp/twitch-eventsub-framework/esb"
)
const (
// These are usually created by your application automatically
clientID = `abc123`
appToken = `def456`
// Key for verifying webhook requests
secretKey = `hey this is really secret`
)
func main() {
client := esf.NewSubClient(esf.NewStaticCredentials(clientID, appToken))
res, _ := client.Subscribe(context.Background(), &esf.SubRequest{
Type: "channel.update",
Condition: esb.ConditionChannelUpdate{
BroadcasterUserID: "22484632",
},
Callback: "https://my.website/api/twitch/webhooks",
Secret: secretKey,
})
fmt.Printf("Using %d/%d of webhook cost limit\n", res.TotalCost, res.MaxTotalCost)
}