From 65ed841f297f911ed973020ea426ae372d6a4719 Mon Sep 17 00:00:00 2001 From: gempir Date: Tue, 5 May 2020 22:04:11 +0200 Subject: [PATCH] clientSecret option added --- config.json.dist | 1 + config/main.go | 1 + go.mod | 2 +- go.sum | 2 ++ helix/user.go | 5 +++-- main.go | 2 +- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config.json.dist b/config.json.dist index a76c031..1d294cf 100644 --- a/config.json.dist +++ b/config.json.dist @@ -4,6 +4,7 @@ "username": "gempbot", "oauth": "oauthtokenforchat", "clientID": "mytwitchclientid", + "clientSecret": "mysecret", "logLevel": "info", "channels": ["77829817", "11148817"], "channelConfigs": { diff --git a/config/main.go b/config/main.go index c69413b..431f3d4 100644 --- a/config/main.go +++ b/config/main.go @@ -21,6 +21,7 @@ type Config struct { Admin string `json:"admin"` Channels []string `json:"channels"` ClientID string `json:"clientID"` + ClientSecret string `json:"clientSecret"` LogLevel string `json:"logLevel"` ChannelConfigs map[string]ChannelConfig `json:"channelConfigs"` } diff --git a/go.mod b/go.mod index c254ec7..34a0473 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.12 require ( github.com/gempir/go-twitch-irc/v2 v2.2.0 github.com/kr/pretty v0.1.0 // indirect - github.com/nicklaw5/helix v0.5.7 + github.com/nicklaw5/helix v0.5.8 github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd // indirect github.com/sirupsen/logrus v1.4.2 diff --git a/go.sum b/go.sum index a761dc3..3fd6d98 100644 --- a/go.sum +++ b/go.sum @@ -12,6 +12,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/nicklaw5/helix v0.5.7 h1:DvNyoKkuLYrqZv5/yugL18Ud99UeQoXzzAsg4OwU8uY= github.com/nicklaw5/helix v0.5.7/go.mod h1:nRcok4VLg8ONQYW/iXBZ24wcfiJjTlDbhgk0ZatOrUY= +github.com/nicklaw5/helix v0.5.8 h1:RG1vV/XDI6Kc0V/KvoUzRb3Q/7rmAQvVuisfxxYg1ZY= +github.com/nicklaw5/helix v0.5.8/go.mod h1:nRcok4VLg8ONQYW/iXBZ24wcfiJjTlDbhgk0ZatOrUY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk= diff --git a/helix/user.go b/helix/user.go index e12ebf4..38edd11 100644 --- a/helix/user.go +++ b/helix/user.go @@ -26,9 +26,10 @@ func init() { } // NewClient Create helix client -func NewClient(clientID string) Client { +func NewClient(clientID string, clientSecret string) Client { client, err := helixClient.NewClient(&helixClient.Options{ - ClientID: clientID, + ClientID: clientID, + ClientSecret: clientSecret, }) if err != nil { panic(err) diff --git a/main.go b/main.go index 2df2d21..691892c 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ func main() { cfg := config.NewConfig(*configFile) fileLogger := filelog.NewFileLogger(cfg.LogsDirectory) - helixClient := helix.NewClient(cfg.ClientID) + helixClient := helix.NewClient(cfg.ClientID, cfg.ClientSecret) archiver := archiver.NewArchiver(cfg.LogsDirectory) go archiver.Boot()