Feature:
Our tests are PASSING!
NOTE:
-----
Before running tests, provide the environment variable,
TEST_GAME_SHORT_NAME, whose value is the short name of a game
created for the test bot. It is used in testing methods for
games, such as TelegramBot#sendGame().
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!
Feature:
We can now pass a custom API Base URL to
be used during making HTTP requests. This is useful in
proxying requests, or running tests.
In particular, this library is (almost) ready to
be used with PWRTelegram API (http://pwrtelegram.xyz/).
Feature:
For finer control over bot's polling and web-hook, the
following methods have been added:
* TelegramBot#isPolling()
* TelegramBot#openWebHook()
* TelegramBot#closeWebHook()
* TelegramBot#hasOpenWebHook()
Please read README.md for more information on the
new methods.
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.