telegram-bot-api/bot.go

24 lines
371 B
Go
Raw Normal View History

package tgbotapi
type BotApi struct {
Token string `json:"token"`
Debug bool `json:"debug"`
2015-06-25 23:44:14 -05:00
Self User `json:"-"`
Updates chan Update `json:"-"`
}
2015-06-25 23:44:14 -05:00
func NewBotApi(token string) (*BotApi, error) {
bot := &BotApi{
Token: token,
}
2015-06-25 23:44:14 -05:00
self, err := bot.GetMe()
if err != nil {
2015-06-25 23:45:56 -05:00
return &BotApi{}, err
2015-06-25 23:44:14 -05:00
}
bot.Self = self
2015-06-25 23:45:56 -05:00
return bot, nil
}