first commit
This commit is contained in:
46
internal/config/config.go
Normal file
46
internal/config/config.go
Normal file
@ -0,0 +1,46 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Username string
|
||||
OAuth string
|
||||
ClientID string
|
||||
Channel string
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
// TODO: Replace these with your actual values
|
||||
cfg := &Config{
|
||||
Username: "", // Your Twitch bot username
|
||||
OAuth: "", // Get from https://twitchtokengenerator.com/
|
||||
ClientID: "", // Get from https://twitchtokengenerator.com/ (new field)
|
||||
Channel: "", // Channel to join (without #)
|
||||
}
|
||||
|
||||
// Validate configuration
|
||||
if cfg.Username == "" {
|
||||
log.Fatal("Username cannot be empty")
|
||||
}
|
||||
if cfg.OAuth == "" {
|
||||
log.Fatal("OAuth token cannot be empty")
|
||||
}
|
||||
if cfg.ClientID == "" {
|
||||
log.Fatal("Client ID cannot be empty - required for Helix API calls as of May 1st")
|
||||
}
|
||||
if cfg.Channel == "" {
|
||||
log.Fatal("Channel cannot be empty")
|
||||
}
|
||||
|
||||
// Ensure OAuth token has proper format for IRC
|
||||
if !strings.HasPrefix(cfg.OAuth, "oauth:") {
|
||||
cfg.OAuth = "oauth:" + cfg.OAuth
|
||||
}
|
||||
|
||||
log.Printf("Loaded config for user: %s, channel: #%s", cfg.Username, cfg.Channel)
|
||||
log.Printf("Client ID configured: %s", cfg.ClientID[:8]+"...") // Only show first 8 chars for security
|
||||
return cfg
|
||||
}
|
Reference in New Issue
Block a user