-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.go
45 lines (39 loc) · 881 Bytes
/
bot.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package vampbot
import (
"log"
)
type Config struct {
DToken string
TToken string
TName string
Owner string
Prefix string
}
type VampBot struct {
Logger *log.Logger
Creds Config
Discord *DiscordHandler
Twitch *TwitchHandler
Library *LibraryHandler
Database *DatabaseHandler
}
func MakeVampBot(args Config) *VampBot {
This := &VampBot{Creds: args}
This.Logger = log.Default()
This.Database = MakeDatabaseHandler(This, "data.db")
This.Library = MakeLibraryHandler(This)
This.Discord = MakeDiscordHandler(This)
This.Twitch = MakeTwitchHandler(This)
return This
}
func (bot *VampBot) Start() {
bot.Discord.Start()
bot.Twitch.Start()
bot.Logger.Println("[SETUP] Now running. Press CTRL-C to exit.")
}
func (bot *VampBot) Stop() {
bot.Logger.Println("[SETUP] Shutting down...")
bot.Discord.Stop()
bot.Twitch.Stop()
bot.Database.Bolt.Close()
}