-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
executable file
·42 lines (34 loc) · 869 Bytes
/
main.go
File metadata and controls
executable file
·42 lines (34 loc) · 869 Bytes
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
package main
import (
"log"
"teomebot/config"
"teomebot/controllers"
"teomebot/utils"
"time"
"github.com/gempir/go-twitch-irc/v4"
"github.com/joho/godotenv"
)
func main() {
godotenv.Load()
settings, err := config.LoadConfig()
if err != nil {
log.Println(err)
panic("erro ao carregar configuração")
}
con, err := utils.OpenDBConnection(settings)
if err != nil {
panic("erro na conexão com banco")
}
log.Println("Criando cliente da Twitch")
client := twitch.NewClient(settings.TwitchBot, settings.TwitchOauthBot)
log.Println("Iniciando o controller de comandos...")
controllerCommands, err := controllers.NewCommandsController(client, con, settings)
if err != nil {
panic("erro ao iniciar controller de comandos")
}
log.Println("Capturando comandos")
go controllerCommands.HandleMessages()
for {
time.Sleep(time.Hour * 1)
}
}