github.com/hungdoo/bot@v0.0.0-20240325145135-dd1f386f7b81/src/main.go (about) 1 package main 2 3 import ( 4 "github.com/hungdoo/bot/src/packages/db" 5 "github.com/hungdoo/bot/src/packages/dotenv" 6 "github.com/hungdoo/bot/src/services/telecommands" 7 ) 8 9 func main() { 10 dotenv.InitEnv() 11 12 _db := db.GetDb() 13 defer _db.Close() 14 15 commandService := telecommands.NewService() 16 commandService.RegisterCommands() 17 18 if dotenv.GetEnv("SERVICE_MODE") == "listener" { 19 commandService.ListenToCommand() 20 } else { 21 commandService.Work() 22 } 23 }