diff --git a/main.go b/main.go index bc47778..89c4225 100755 --- a/main.go +++ b/main.go @@ -70,7 +70,7 @@ func readConfig() { rgb.RPrintf("[%s] Could not unmarshal `%s`. Unmarshal error: %s\n", irc.TimeStamp(), configFile, err) os.Exit(1) } - rgb.YPrintf("[%s] Read config file from `%s\n`", irc.TimeStamp(), configFile) + rgb.YPrintf("[%s] Read config file from `%s`\n", irc.TimeStamp(), configFile) return } @@ -147,7 +147,10 @@ func readBonusStrings() []string { return customStrings.Strings } +var buildDate string + func main() { + rgb.YPrintf("[%s] starting karaokard bot build %s\n", irc.TimeStamp(), buildDate) readConfig() rand.Seed(time.Now().UnixNano()) for _, val := range builtins.Karaokards { @@ -156,6 +159,13 @@ func main() { for _, val := range readBonusStrings() { selectablePrompts = append(selectablePrompts, val) } + persistentData := openDatabase() + var dbGlobalPrompts []string + if err := persistentData.Read("prompts", "global", &dbGlobalPrompts); err != nil { + persistentData.Write("prompts", "common", dbGlobalPrompts) + } + selectablePrompts := append(selectablePrompts, dbGlobalPrompts...) + rgb.YPrintf("[%s] %d prompts available.\n", irc.TimeStamp(), len(selectablePrompts)) oauthPath := "" if config.OAuthPath == "" { @@ -183,8 +193,6 @@ func main() { } oauthPath = config.OAuthPath } - persistentData := openDatabase() - persistentData.Write("prompts", "common", selectablePrompts) // Replace the channel name, bot name, and the path to the private directory with your respective // values. @@ -196,6 +204,7 @@ func main() { PrivatePath: oauthPath, Server: "irc.chat.twitch.tv", Prompts: selectablePrompts, + Database: *persistentData, } go func() { rgb.YPrintf("[%s] Starting webserver on port %s\n", irc.TimeStamp(), "5353")