Bug:
On certain errors, during polling, cause the following error to be
thrown:
TypeError: Cannot read property 'statusCode' of undefined
This is caused when we try to access the 'response' property on
the error object in the error handler (`catch(error)`). It goes
missing when the error was fatal, for example, network error, thus
no server response available.
References:
* Issue #281: https://github.com/yagop/node-telegram-bot-api/issues/281
* Reported-by: @dimawebmaker
Feature:
The different mechanisms of fetching updates, i.e. polling
and webhook, have had their implementations improved:
* the TelegramBot instance needs to create the polling and
webhook instances once, and when necessary
* returning promises from TelegramBot#openWebHook() and
TelegramBot#startPolling() allows more precise control
Also,
* TelegramBot#initPolling() is being deprecated in favor of
TelegramBot#startPolling() to ensure consistency (as the
opposite action of TelegramBot#stopPolling())
Bug:
TelegramBot#stopPolling() fails to clear the timeout
that is waiting to make the next polling request.
Thus, if the method is invoked after the timeout has
already been set up, once the timeout fn is executed,
another request is made, before polling is stopped in the
'.finally()' handler of the request!