123456789101112131415161718192021222324252627282930313233343536 |
- package main
- import (
- "fmt"
- "log"
- "net/http"
- api "github.com/nchursin/formtgbot/api"
- "github.com/nchursin/formtgbot/telegram"
- )
- func main() {
- go getBotUpdates()
- listenAndServe()
- }
- func listenAndServe() {
- fmt.Printf("Starting server for Bot Careers API...\n")
- http.ListenAndServe(":8080", api.Routes())
- }
- func getBotUpdates() {
- bot := telegram.GetBot()
- channel := bot.ListenForUpdates()
- for update := range channel {
- log.Printf("----------------------------------------------------")
- log.Printf("[%s] %+v", "update.InlineQuery", update.InlineQuery)
- log.Printf("[%s] %+v", "update.CallbackQuery", update.CallbackQuery)
- log.Printf("[%s] %+v", "update.Message", update.Message)
- telegram.Routes(&update)
- }
- }
|