bloaterbot/main.go
watn3y 6375fe5af1 A bunch of Changes
Docker is broken as of now, will fix later
2023-12-29 05:15:23 +01:00

51 lines
997 B
Go

package main
import (
"flag"
"fmt"
"os"
"time"
"watn3y.de/bloaterbot/commands/gaypoints"
"watn3y.de/bloaterbot/commands/notify"
"watn3y.de/bloaterbot/config"
"watn3y.de/bloaterbot/webserver"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func main() {
fmt.Println("Starting bloaterbot...")
configureLogger()
encodeConfig := flag.Bool("generate-example-config", false, "Generates a example config to config.toml.example")
flag.Parse()
if *encodeConfig {
config.EncodeToml()
os.Exit(0)
}
config.LoadConfig()
gaypoints.InitDB()
notify.InitDB()
go webserver.RunServer()
bot()
}
func configureLogger() {
output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.DateTime}
log.Logger = zerolog.New(output).With().Timestamp().Caller().Logger()
//! note that we overwrite the loglevel after loading the config in config/config.go:53. This is just the default
zerolog.SetGlobalLevel(zerolog.DebugLevel)
log.Info().Msg("Started zerolog logger")
}