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-26 06:44:14 +02:00
Self User `json:"-"`
Updates chan Update `json:"-"`
}
2015-06-26 06:44:14 +02:00
func NewBotApi(token string) (*BotApi, error) {
bot := &BotApi{
Token: token,
}
2015-06-26 06:44:14 +02:00
self, err := bot.GetMe()
if err != nil {
2015-06-26 06:45:56 +02:00
return &BotApi{}, err
2015-06-26 06:44:14 +02:00
}
bot.Self = self
2015-06-26 06:45:56 +02:00
return bot, nil
}