Mercurial > public > pacobot
comparison event/events.go @ 12:aaf85ae1f942
add very simple html template
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Thu, 20 Mar 2025 11:12:21 +0000 |
parents | e9df3bb010f4 |
children |
comparison
equal
deleted
inserted
replaced
11:6d91c612310a | 12:aaf85ae1f942 |
---|---|
8 "net/url" | 8 "net/url" |
9 | 9 |
10 "github.com/denniscmcom/pacobot/auth" | 10 "github.com/denniscmcom/pacobot/auth" |
11 ) | 11 ) |
12 | 12 |
13 func ChannelChatMsgSub(authToken, session_id string) { | 13 func SubChannelChatMsg(authToken, session_id string) { |
14 config := auth.ReadConfig() | 14 config := auth.ReadConfig() |
15 | 15 |
16 data := map[string]any{ | 16 data := map[string]any{ |
17 "type": "channel.chat.message", | 17 "type": "channel.chat.message", |
18 "version": "1", | 18 "version": "1", |
31 if err != nil { | 31 if err != nil { |
32 log.Fatal(err) | 32 log.Fatal(err) |
33 } | 33 } |
34 | 34 |
35 log.Printf("event: subscribing to %s", data["type"]) | 35 log.Printf("event: subscribing to %s", data["type"]) |
36 eventSub(authToken, jsonData) | 36 subEvent(authToken, jsonData) |
37 } | 37 } |
38 | 38 |
39 func eventSub(authToken string, subData []byte) { | 39 func subEvent(authToken string, subData []byte) { |
40 baseUrl := &url.URL{ | 40 baseUrl := &url.URL{ |
41 Scheme: "https", | 41 Scheme: "https", |
42 Host: "api.twitch.tv", | 42 Host: "api.twitch.tv", |
43 Path: "helix/eventsub/subscriptions", | 43 Path: "helix/eventsub/subscriptions", |
44 } | 44 } |