all repos — telegram-bot-api @ 76460f8a5b8b89b816998eefbac35b80ec96a06f

Golang bindings for the Telegram Bot API

bot.go (view raw)

 1package tgbotapi
 2
 3type BotApi struct {
 4	Token   string      `json:"token"`
 5	Debug   bool        `json:"debug"`
 6	Self    User        `json:"-"`
 7	Updates chan Update `json:"-"`
 8}
 9
10func NewBotApi(token string) (*BotApi, error) {
11	bot := &BotApi{
12		Token: token,
13	}
14
15	self, err := bot.GetMe()
16	if err != nil {
17		return &BotApi{}, err
18	}
19
20	bot.Self = self
21
22	return bot, nil
23}