diff --git a/model.go b/model.go index 895d89c..f51c4c7 100644 --- a/model.go +++ b/model.go @@ -90,7 +90,8 @@ type VoiceServerUpdate struct { type VoiceProcessingData struct { io.ReadCloser - Client *http.Client + node *Node + UserID string URL string File string @@ -99,7 +100,11 @@ type VoiceProcessingData struct { } func (v *VoiceProcessingData) open() error { - res, err := v.Client.Get(v.URL) + req, err := http.NewRequest(http.MethodGet, v.URL, nil) + + req.Header.Set("Authorization", v.node.config.Password) + + res, err := v.node.client.Do(req) if err != nil { return err diff --git a/node.go b/node.go index 0c1cdf7..aebb06f 100644 --- a/node.go +++ b/node.go @@ -208,7 +208,7 @@ func (node *Node) onEvent(v *fastjson.Value, msg []byte) error { track := jsonStringValue(v, "track") data := &VoiceProcessingData{ - Client: node.client, + node: node, UserID: jsonStringValue(v, "userId"), URL: fmt.Sprintf("%s/audio/%s", node.config.REST, track), File: track,