Skip to content

Commit

Permalink
Check api server is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
onrik committed May 30, 2021
1 parent 803afea commit e0e79a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ func NewBot(token string, opts ...Option) (*Bot, error) {
opt(&options)
}

ctx, cancelFunc := context.WithCancel(context.Background())

bot := Bot{
Options: options,
token: token,
updates: make(chan Update),
Options: options,
token: token,
updates: make(chan Update),
ctx: ctx,
cancelFunc: cancelFunc,
}

bot.ctx, bot.cancelFunc = context.WithCancel(context.Background())
if bot.apiServer == "" {
bot.apiServer = defaultAPIServer
}

me, err := bot.GetMe()
if err != nil {
Expand Down

0 comments on commit e0e79a3

Please sign in to comment.