summary refs log tree commit diff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go45
1 files changed, 16 insertions, 29 deletions
diff --git a/main.go b/main.go
index 462cd96..f0f40a2 100644
--- a/main.go
+++ b/main.go
@@ -2,6 +2,7 @@ package main
 
 import (
 	"fmt"
+	"os"
 	"strings"
 
 	"github.com/nicklaw5/helix/v2"
@@ -9,23 +10,22 @@ import (
 	"golang.org/x/oauth2/clientcredentials"
 )
 
+const DEBUG bool = false
+const USERNAME string = "venomade98" // TODO: Make configurable
+
 var (
-	clientSecrets = Secrets("/home/venomade/.local/share/lifesigns/secrets")
-	clientID = clientSecrets.ClientID
-	clientSecret = clientSecrets.ClientSecret // Refactor
-	authFile = "/home/venomade/.local/share/lifesigns/auth"
-	secretsFile = "/home/venomade/.local/share/lifesigns/secrets"
+	dataDir = fmt.Sprintf("%s/.local/share/lifesigns", os.Getenv("HOME"))
+	clientSecrets = Secrets(fmt.Sprintf("%s/secrets", dataDir))
 	// Fix Hardcodes
 	oauth2Config *clientcredentials.Config
 )
 
 func main() {
-
-	userTokens := Auth(authFile);
+	userTokens := Auth(fmt.Sprintf("%s/auth", dataDir));
 	
 	client, err := helix.NewClient(&helix.Options{
-		ClientID: clientID,
-		ClientSecret: clientSecret,
+		ClientID: clientSecrets.ClientID,
+		ClientSecret: clientSecrets.ClientSecret,
 		AppAccessToken: GetAppToken(),
 		UserAccessToken: userTokens.AccessToken,
 		RefreshToken: userTokens.RefreshToken,
@@ -34,25 +34,10 @@ func main() {
 		panic(err)
 	}
 
-	// resp, err := client.GetUsers(&helix.UsersParams{
-	// 	IDs:    []string{"26301881", "18074328"},
-	// 	Logins: []string{"summit1g", "lirik"},
-	// })
-	
-	// resp, err := client.GetFollowedStream(&helix.FollowedStreamsParams{
-	// 	UserID: "venomade98",
-	// })
-	// resp, err := client.GetFollowedChannels(&helix.GetFollowedChannelParams{
-	// 	UserID: GetUserID(client),
-	// })
-
 	resp, err := client.GetFollowedStream(&helix.FollowedStreamsParams{
 		UserID: GetUserID(client),
 	})
 
-	// for _, channel := range resp.Data.FollowedChannels {
-	// 	fmt.Println("Channel:", channel.BroadcasterName)
-	// }
 	var output strings.Builder
 	
 	for _, channel := range resp.Data.Streams {
@@ -71,11 +56,13 @@ func GetUserID(client *helix.Client) string{
 		panic(err)
 	}
 
-	// fmt.Printf("Status code: %d\n", resp.StatusCode)
-	// fmt.Printf("Error: %s\n", resp.ErrorMessage)
-	// fmt.Printf("Rate limit: %d\n", resp.GetRateLimit())
-	// fmt.Printf("Rate limit remaining: %d\n", resp.GetRateLimitRemaining())
-	// fmt.Printf("Rate limit reset: %d\n\n", resp.GetRateLimitReset())
+	if DEBUG {
+		fmt.Printf("Status code: %d\n", resp.StatusCode)
+		fmt.Printf("Error: %s\n", resp.ErrorMessage)
+		fmt.Printf("Rate limit: %d\n", resp.GetRateLimit())
+		fmt.Printf("Rate limit remaining: %d\n", resp.GetRateLimitRemaining())
+		fmt.Printf("Rate limit reset: %d\n\n", resp.GetRateLimitReset())
+	}
 
 	var uid string;