database and build date
Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
parent
fad3079132
commit
6e7c52879c
15
main.go
15
main.go
|
@ -70,7 +70,7 @@ func readConfig() {
|
||||||
rgb.RPrintf("[%s] Could not unmarshal `%s`. Unmarshal error: %s\n", irc.TimeStamp(), configFile, err)
|
rgb.RPrintf("[%s] Could not unmarshal `%s`. Unmarshal error: %s\n", irc.TimeStamp(), configFile, err)
|
||||||
os.Exit(1)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,10 @@ func readBonusStrings() []string {
|
||||||
return customStrings.Strings
|
return customStrings.Strings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var buildDate string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
rgb.YPrintf("[%s] starting karaokard bot build %s\n", irc.TimeStamp(), buildDate)
|
||||||
readConfig()
|
readConfig()
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
for _, val := range builtins.Karaokards {
|
for _, val := range builtins.Karaokards {
|
||||||
|
@ -156,6 +159,13 @@ func main() {
|
||||||
for _, val := range readBonusStrings() {
|
for _, val := range readBonusStrings() {
|
||||||
selectablePrompts = append(selectablePrompts, val)
|
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))
|
rgb.YPrintf("[%s] %d prompts available.\n", irc.TimeStamp(), len(selectablePrompts))
|
||||||
oauthPath := ""
|
oauthPath := ""
|
||||||
if config.OAuthPath == "" {
|
if config.OAuthPath == "" {
|
||||||
|
@ -183,8 +193,6 @@ func main() {
|
||||||
}
|
}
|
||||||
oauthPath = config.OAuthPath
|
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
|
// Replace the channel name, bot name, and the path to the private directory with your respective
|
||||||
// values.
|
// values.
|
||||||
|
@ -196,6 +204,7 @@ func main() {
|
||||||
PrivatePath: oauthPath,
|
PrivatePath: oauthPath,
|
||||||
Server: "irc.chat.twitch.tv",
|
Server: "irc.chat.twitch.tv",
|
||||||
Prompts: selectablePrompts,
|
Prompts: selectablePrompts,
|
||||||
|
Database: *persistentData,
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
rgb.YPrintf("[%s] Starting webserver on port %s\n", irc.TimeStamp(), "5353")
|
rgb.YPrintf("[%s] Starting webserver on port %s\n", irc.TimeStamp(), "5353")
|
||||||
|
|
Loading…
Reference in New Issue