mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-22 18:07:16 +00:00
feat: Support test enviroment (#994)
* Added a support for testing enviroment * Added annotation for testing enviroment and run doc Co-authored-by: Mohamed Sohail <sohailsameja@gmail.com>
This commit is contained in:
parent
f50cf982c7
commit
c9b05e7996
@ -136,6 +136,7 @@ Emits `message` when a message arrives.
|
||||
| [options] | <code>Object</code> | | |
|
||||
| [options.polling] | <code>Boolean</code> \| <code>Object</code> | <code>false</code> | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. |
|
||||
| [options.polling.timeout] | <code>String</code> \| <code>Number</code> | <code>10</code> | *Deprecated. Use `options.polling.params` instead*. Timeout in seconds for long polling. |
|
||||
| [options.testEnvironment] | <code>Boolean</code> | <code>false</code> | 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] | <code>String</code> \| <code>Number</code> | <code>300</code> | Interval between requests in miliseconds |
|
||||
| [options.polling.autoStart] | <code>Boolean</code> | <code>true</code> | Start polling immediately |
|
||||
| [options.polling.params] | <code>Object</code> | | 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 | <code>Number</code> | | User identifier of sticker set owner |
|
||||
| name | <code>String</code> | | Sticker set name |
|
||||
| sticker | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | | 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 | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | | 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 | <code>String</code> | | One or more emoji corresponding to the sticker |
|
||||
| stickerType | <code>String</code> | <code>png_sticker</code> | Allow values: `png_sticker`, `tgs_sticker`, or `webm_sticker`. |
|
||||
| [options] | <code>Object</code> | | Additional Telegram query options |
|
||||
|
@ -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}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user