1
0
mirror of synced 2024-11-22 04:26:01 +03:00
mg-transport-telegram/telegram.go
2018-05-24 15:33:11 +03:00

28 lines
566 B
Go

package main
import (
"net/http"
"github.com/go-telegram-bot-api/telegram-bot-api"
)
func setTransportRoutes() {
http.HandleFunc("/add-bot/", addBotHandler)
http.HandleFunc("/activity-bot/", activityBotHandler)
http.HandleFunc("/telegram/", makeHandler(telegramWebhookHandler))
}
// GetBotInfo function
func GetBotInfo(token string) (*tgbotapi.BotAPI, error) {
bot, err := tgbotapi.NewBotAPI(token)
if err != nil {
return nil, err
}
return bot, nil
}
// GetBotName function
func GetBotName(bot *tgbotapi.BotAPI) string {
return bot.Self.FirstName
}