Skip to content

Commit

Permalink
Merge pull request #603 from tdakkota/fix/bot-from-env-setup
Browse files Browse the repository at this point in the history
fix(telegram): call setup only if it is not nil
  • Loading branch information
ernado committed Dec 5, 2021
2 parents e98b241 + 5f4ca62 commit 890ce99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions telegram/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ func BotFromEnvironment(
return errors.Wrap(err, "create client")
}

if err := setup(ctx, client); err != nil {
return errors.Wrap(err, "setup")
if setup != nil {
if err := setup(ctx, client); err != nil {
return errors.Wrap(err, "setup")
}
}

return client.Run(ctx, func(ctx context.Context) error {
Expand Down

0 comments on commit 890ce99

Please sign in to comment.