random commit

This commit is contained in:
bryce
2025-07-14 20:46:12 +12:00
parent 466cfb197c
commit 5b286926a3
6 changed files with 53 additions and 42 deletions

View File

@@ -7,16 +7,28 @@ import (
"time"
twitch "github.com/gempir/go-twitch-irc/v4"
helix "github.com/nicklaw5/helix"
twitchapi "streambot_twitch/internal/twitchapi"
)
// check Twitch API connectivity
func TestTwitchAPI(client *twitchapi.Client, streamerChannel string) error {
_, err := client.GetUserID(streamerChannel)
userID, err := client.GetUserID(streamerChannel)
if err != nil {
return fmt.Errorf("Twitch API test failed: %w", err)
return fmt.Errorf("failed to get Usre ID: %w", err)
}
log.Println("Twitch API connection successful")
resp, err := client.api.GetChannelInformation(&helix.GetChannelInformationParams{
BroadcasterID: userID,
})
if err != nil {
return fmt.Errorf("failed to get channel information: %w", err)
}
if len(resp.Data.Channels) == 0 {
return fmt.Errorf("no channel information found")
}
log.Printf("Twitch API connection Test Successful for channel: %s", streamerChannel)
return nil
}