From 3fb3be625e6350a57083db2fd4d158b0b9ef125b Mon Sep 17 00:00:00 2001 From: Madh93 Date: Sat, 28 Dec 2024 17:30:01 +0000 Subject: [PATCH] fix: update main --- main.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index b6ba2d1..d7795d1 100644 --- a/main.go +++ b/main.go @@ -4,10 +4,33 @@ package main import ( "fmt" + + "github.com/Madh93/hoarderbot/internal/config" + "github.com/Madh93/hoarderbot/internal/hoarderbot" + "github.com/Madh93/hoarderbot/internal/logging" ) // main initializes the configuration, sets up logging, and starts the // Hoarderbot. func main() { - fmt.Println("Hello World!") + // Load configuration + config := config.New() + + // Setup logger + logger := logging.New(&config.Logging) + if config.Path != "" { + logger.Debug(fmt.Sprintf("Loaded configuration from %s", config.Path)) + } + + // Setup hoarderbot + hoarderbot := hoarderbot.New(logger, &hoarderbot.Config{ + Hoarder: &config.Hoarder, + Telegram: &config.Telegram, + }) + + // Let's go + logger.Info("3, 2, 1... Launching Hoarderbot... 🚀") + if err := hoarderbot.Run(); err != nil { + logger.Fatal("💥 Something went wrong.", "error", err) + } }