-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
31 lines (26 loc) · 778 Bytes
/
init.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"github.com/jamestjw/lyrical/help"
"github.com/jamestjw/lyrical/models"
"github.com/jamestjw/lyrical/searcher"
"github.com/jamestjw/lyrical/voice"
log "github.com/sirupsen/logrus"
)
var searchService Searcher
func initialiseApplication() {
help.InitialiseHelpText()
models.InitialiseDatabase("production")
loadConfig()
searchService = searcher.InitialiseYoutubeService(config.YoutubeAPIKey)
}
func shutdownApplication(dg voice.Connectable) {
log.Println("Received signal to terminate, cleaning up...")
// Cleanly close down the Discord session.
voice.DisconnectAllVoiceConnections(dg.(voice.Connectable))
err := models.DS.Close()
if err != nil {
log.Error("Error closing models connection")
return
}
log.Info("Exit successful!")
}