Feature:
Currently, if the constructor option 'options.webHook' is passed,
the bot opens the webHook immediately! There's NO way to disable
this behavior, which might be useful in cases such as:
* providing custom webhook parameters without opening the webhook
immediately
The new boolean option, 'autoOpen', can now be used to control this
behavior. For example,
```js
const bot = new TelegramBot(token, {
webHook: {
autoOpen: false,
},
});
```
If set to 'false', the bot does NOT open the web-hook immediately.
Currently, there's NO way to open the web-hook in this case.
I'm working on that. Expect a feature to add a method to open
the web-hook manually!
If not provided, its value defaults to 'true'.
Implementation:
* Backwards-compatible: the behavior of opening the web-hook
immediately remains, when the parameter is NOT provided.
Feature:
Currently, if the constructor option 'options.polling' is
passed, the bot begins polling immediately! There's NO
way to disable this behavior, which might be useful in
cases such as:
* providing custom polling parameters without starting
the polling immediately
The boolean option, 'autoStart', can now be used to control this
behavior. For example,
```js
const bot = new TelegramBot(token, {
polling: {
autoStart: false,
},
});
```
If set to 'false', the bot does NOT begin polling
immediately. You'll have to use TelegramBot#initPolling().
If not provided, its value defaults to 'true'.
Implementation:
* Backwards-compatible: the behavior of starting polling
immediately remains, when the parameter is NOT provided
* Fixes the readme with an appropriate example that doesn't crash
Addresses #45
* [docs] Use simple example in Readme
References:
* Original PR: https://github.com/yagop/node-telegram-bot-api/pull/54
* [docs] Improve the example in the Readme
Bug:
The test for `TelegramBot#_formatSendData()` is only applicable on
newer versions of Node.js (v6+) that support passing a Buffer
representation of the path to `fs.createReadStream()`.
Fix:
If the runtime does NOT supports passing the Buffer argument, do
NOT run the test on it. This is safe since we are sure that
`fs.ReadStream.path` will never be a Buffer on the runtime being
tested.