diff --git a/doc/api.md b/doc/api.md index e1e309c..fb1a2fd 100644 --- a/doc/api.md +++ b/doc/api.md @@ -136,6 +136,7 @@ Emits `message` when a message arrives. | [options] | Object | | | | [options.polling] | Boolean \| Object | false | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. | | [options.polling.timeout] | String \| Number | 10 | *Deprecated. Use `options.polling.params` instead*. Timeout in seconds for long polling. | +| [options.testEnvironment] | Boolean | false | Set true to work with test enviroment. When working with the test environment, you may use HTTP links without TLS to test your Web App. | | [options.polling.interval] | String \| Number | 300 | Interval between requests in miliseconds | | [options.polling.autoStart] | Boolean | true | Start polling immediately | | [options.polling.params] | Object | | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. | @@ -1677,7 +1678,7 @@ Animated stickers can be added to animated sticker sets and only to them: | --- | --- | --- | --- | | userId | Number | | User identifier of sticker set owner | | name | String | | Sticker set name | -| sticker | String \| stream.Stream \| Buffer | | Png image with the sticker (must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px), [TGS animation](https://core.telegram.org/stickers#animated-sticker-requirements) with the sticker or [WEBM video](https://core.telegram.org/stickers#video-sticker-requirements) with the sticker. | +| sticker | String \| stream.Stream \| Buffer | | Png image with the sticker (must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px, [TGS animation](https://core.telegram.org/stickers#animated-sticker-requirements) with the sticker or [WEBM video](https://core.telegram.org/stickers#video-sticker-requirements) with the sticker. | | emojis | String | | One or more emoji corresponding to the sticker | | stickerType | String | png_sticker | Allow values: `png_sticker`, `tgs_sticker`, or `webm_sticker`. | | [options] | Object | | Additional Telegram query options | diff --git a/src/telegram.js b/src/telegram.js index 2914e98..6e99ff1 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -121,6 +121,8 @@ class TelegramBot extends EventEmitter { * If a WebHook has been set, it will be deleted automatically. * @param {String|Number} [options.polling.timeout=10] *Deprecated. Use `options.polling.params` instead*. * Timeout in seconds for long polling. + * @param {Boolean} [options.testEnvironment=false] Set true to work with test enviroment. + * When working with the test environment, you may use HTTP links without TLS to test your Web App. * @param {String|Number} [options.polling.interval=300] Interval between requests in miliseconds * @param {Boolean} [options.polling.autoStart=true] Start polling immediately * @param {Object} [options.polling.params] Parameters to be used in polling API requests. @@ -192,7 +194,7 @@ class TelegramBot extends EventEmitter { * @see https://core.telegram.org/bots/api#making-requests */ _buildURL(_path) { - return `${this.options.baseApiUrl}/bot${this.token}/${_path}`; + return `${this.options.baseApiUrl}/bot${this.token}${this.options.testEnvironment ? '/test' : ''}/${_path}`; } /**