2023-01-05 17:51:53 +00:00
|
|
|
package main
|
|
|
|
|
2023-01-25 19:42:18 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"git.faercol.me/faercol/public-ip-tracker/tracker/bot"
|
|
|
|
"git.faercol.me/faercol/public-ip-tracker/tracker/config"
|
|
|
|
)
|
2023-01-05 17:51:53 +00:00
|
|
|
|
|
|
|
func testMethod(a int) int {
|
|
|
|
return a + 2
|
|
|
|
}
|
|
|
|
|
2023-01-25 19:42:18 +00:00
|
|
|
type cliArgs struct {
|
|
|
|
configPath string
|
|
|
|
}
|
|
|
|
|
|
|
|
func parseArgs() *cliArgs {
|
|
|
|
configPath := flag.String("config", "", "Path to the JSON configuration file")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
return &cliArgs{
|
|
|
|
configPath: *configPath,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-05 17:51:53 +00:00
|
|
|
func main() {
|
2023-01-25 19:42:18 +00:00
|
|
|
fmt.Println("Parsing arguments")
|
|
|
|
args := parseArgs()
|
|
|
|
|
|
|
|
fmt.Println("Parsing config")
|
|
|
|
conf, err := config.New(args.configPath)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("Initializing bot")
|
|
|
|
notifBot := bot.New(context.Background(), conf)
|
|
|
|
if err := notifBot.SendInitMessage(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println("OK")
|
2023-01-05 17:51:53 +00:00
|
|
|
}
|