diff --git a/bot.go b/bot.go index 3cf8c6e..396545a 100644 --- a/bot.go +++ b/bot.go @@ -25,32 +25,19 @@ func StartBot() { } b.Handle("/hello", botHello) - - b.Handle(tb.OnPhoto, func(m *tb.Message) { - fmt.Println("OnPhoto :", m.Text) - // photos only - }) - - b.Handle(tb.OnChannelPost, func (m *tb.Message) { - fmt.Println("OnChannelPost :", m.Text) - PrintText(m) - // channel posts only - }) - - 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 - }) + b.Handle(tb.OnPhoto, botPhoto) + b.Handle(tb.OnChannelPost, botChannel) + b.Handle(tb.OnQuery, botQuery) + b.Handle(tb.OnText, botText) b.Start() } +func botPhoto(m *tb.Message) { + fmt.Println("OnPhoto :", m.Text) +// photos only +} + func botHello(m *tb.Message) { if !m.Private() { return @@ -58,4 +45,21 @@ func botHello(m *tb.Message) { // fmt.Println("Hello payload :", m.Payload) // PrintText(m) b.Send(m.Sender, "hello world") +} + +func botChannelPost(m *tb.Message) { + fmt.Println("OnChannelPost :", m.Text) + PrintText(m) +// channel posts only +} + +func botQuery(q *tb.Query) { + fmt.Println("Query ?") +// incoming inline queries +} + +func botText(m *tb.Message) { + PrintText(m) + // all the text messages that weren't + // captured by existing handlers } \ No newline at end of file