diff --git a/main.go b/main.go index b328f4f..7a57230 100644 --- a/main.go +++ b/main.go @@ -84,50 +84,14 @@ func main() { if (*initdb) { initDB() } - - - // Registering bot - b, err := tb.NewBot(tb.Settings{ - Token: cfg.Telegram.Token, - URL: cfg.Telegram.URL, - Poller: &tb.LongPoller{Timeout: 10 * time.Second}, - }) - - if err != nil { - log.Fatal(err) - return - } - - b.Handle("/hello", func(m *tb.Message) { - if !m.Private() { - return - } -// fmt.Println("Hello payload :", m.Payload) // - PrintText(m) - b.Send(m.Sender, "hello world") - }) - b.Handle(tb.OnPhoto, func(m *tb.Message) { - fmt.Println("OnPhoto :", m.Text) - // photos only - }) + go StartBot() - b.Handle(tb.OnChannelPost, func (m *tb.Message) { - fmt.Println("OnChannelPost :", m.Text) - PrintText(m) - // channel posts only - }) + fmt.Println("Started !") - b.Handle(tb.OnQuery, func (q *tb.Query) { - fmt.Println("Query ?") - // incoming inline queries - }) - - b.Handle(tb.OnText, func(m *tb.Message) { - PrintText(m) - // all the text messages that weren't - // captured by existing handlers - }) + // Main loop + for { + time.Sleep(1 * time.Second) + } - b.Start() } \ No newline at end of file