52 lines
1.5 KiB
Go
Executable File
52 lines
1.5 KiB
Go
Executable File
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
"os"
|
|
"time"
|
|
|
|
irc "git.martyn.berlin/martyn/karaokards/internal/irc"
|
|
)
|
|
|
|
func main() {
|
|
|
|
rand.Seed(time.Now().UnixNano())
|
|
for _, val := range karaokards {
|
|
selectablePrompts = append(selectablePrompts, val)
|
|
}
|
|
for _, val := range readBonusStrings() {
|
|
selectablePrompts = append(selectablePrompts, val)
|
|
}
|
|
fmt.Println(len(selectablePrompts), " prompts available.")
|
|
oauthPath := ""
|
|
if os.Getenv("TWITCH_OAUTH_JSON") != "" {
|
|
if _, err := os.Stat(os.Getenv("TWITCH_OAUTH_JSON")); os.IsNotExist(err) {
|
|
os.Exit(1)
|
|
}
|
|
oauthPath = os.Getenv("TWITCH_OAUTH_JSON")
|
|
} else {
|
|
if _, err := os.Stat(os.Getenv("HOME") + "/.twitch/oauth.json"); os.IsNotExist(err) {
|
|
rgb.YPrintf("[%s] Warning %s doesn't exist, trying %s next!\n", timeStamp(), os.Getenv("HOME")+"/.twitch/oauth.json", "/etc/twitch/oauth.json")
|
|
if _, err := os.Stat("/etc/twitch/oauth.json"); os.IsNotExist(err) {
|
|
rgb.YPrintf("[%s] Error %s doesn't exist either, bailing!\n", timeStamp(), "/etc/twitch/oauth.json")
|
|
os.Exit(1)
|
|
}
|
|
oauthPath = "/etc/twitch/oauth.json"
|
|
} else {
|
|
oauthPath = os.Getenv("HOME") + "/.twitch/oauth.json"
|
|
}
|
|
}
|
|
// Replace the channel name, bot name, and the path to the private directory with your respective
|
|
// values.
|
|
myBot := irc.KardBot{
|
|
Channel: "imartynontwitch",
|
|
MsgRate: time.Duration(20/30) * time.Millisecond,
|
|
Name: "Karaokards",
|
|
Port: "6667",
|
|
PrivatePath: oauthPath,
|
|
Server: "irc.chat.twitch.tv",
|
|
}
|
|
myBot.Start()
|
|
}
|