API.md
April 11, 2023 ยท View on GitHub
API Reference
GroupCaptcha
Captcha for open groups.
Kind: global class
new GroupCaptcha(bot, [options])
| Param | Type | Default | Description |
|---|---|---|---|
| token | String | Bot Token | |
| [telegram_options] | Object | ||
| [telegram_options.polling] | Boolean | Object | false | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. |
| [telegram_options.polling.timeout] | String | Number | 10 | Deprecated. Use options.polling.params instead. Timeout in seconds for long polling. |
| [telegram_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. |
| [telegram_options.polling.interval] | String | Number | 300 | Interval between requests in miliseconds |
| [telegram_options.polling.autoStart] | Boolean | true | Start polling immediately |
| [telegram_options.polling.params] | Object | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. | |
| [telegram_options.polling.params.timeout] | Number | 10 | Timeout in seconds for long polling. |
| [telegram_options.webHook] | Boolean | Object | false | Set true to enable WebHook or set options |
| [telegram_options.webHook.host] | String | "0.0.0.0" | Host to bind to |
| [telegram_options.webHook.port] | Number | 8443 | Port to bind to |
| [telegram_options.webHook.key] | String | Path to file with PEM private key for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.cert] | String | Path to file with PEM certificate (public) for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.pfx] | String | Path to file with PFX private key and certificate chain for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.autoOpen] | Boolean | true | Open webHook immediately |
| [telegram_options.webHook.https] | Object | Options to be passed to https.createServer(). Note that options.webHook.key, options.webHook.cert and options.webHook.pfx, if provided, will be used to override key, cert and pfx in this object, respectively. See https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener for more information. | |
| [telegram_options.webHook.healthEndpoint] | String | "/healthz" | An endpoint for health checks that always responds with 200 OK |
| [telegram_options.onlyFirstMatch] | Boolean | false | Set to true to stop after first match. Otherwise, all regexps are executed |
| [telegram_options.request] | Object | Options which will be added for all requests to telegram api. See https://github.com/request/request#requestoptions-callback for more information. | |
| [telegram_options.baseApiUrl] | String | "https://api.telegram.org" | API Base URl; useful for proxying and testing |
| [telegram_options.filepath] | Boolean | true | Allow passing file-paths as arguments when sending files, such as photos using TelegramBot#sendPhoto(). See [usage information][usage-sending-files-performance] for more information on this option and its consequences. |
| [telegram_options.badRejection] | Boolean | false | Set to true if and only if the Node.js version you're using terminates the process on unhandled rejections. This option is only for forward-compatibility purposes. |
| [options] | Object | ||
| [options.language] | String | "en" | Language. |
| [options.size] | Number | 4 | Captcha length < 9 (number of characters). |
| [options.time_for_enter] | Number | 5 | Time for enter captcha (in minutes). |
captcha.generateCaptcha(msg)
Generating and sending a calendar to the user. Sets the current month and year.
Kind: instance method of GroupCaptcha
| Param | Type | Description |
|---|---|---|
| msg | Object | https://core.telegram.org/bots/api#message |
captcha.clickKeyboard(query)
Generating and sending a time selector to the user.
Kind: instance method of GroupCaptcha
| Param | Type | Description |
|---|---|---|
| query | Object | https://core.telegram.org/bots/api#callbackquery |
GroupCaptchaRTJ
Captcha for groups with requests to join.
Kind: global class
new GroupCaptchaRTJ(bot, [options])
| Param | Type | Default | Description |
|---|---|---|---|
| token | String | Bot Token | |
| [telegram_options] | Object | ||
| [telegram_options.polling] | Boolean | Object | false | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. |
| [telegram_options.polling.timeout] | String | Number | 10 | Deprecated. Use options.polling.params instead. Timeout in seconds for long polling. |
| [telegram_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. |
| [telegram_options.polling.interval] | String | Number | 300 | Interval between requests in miliseconds |
| [telegram_options.polling.autoStart] | Boolean | true | Start polling immediately |
| [telegram_options.polling.params] | Object | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. | |
| [telegram_options.polling.params.timeout] | Number | 10 | Timeout in seconds for long polling. |
| [telegram_options.webHook] | Boolean | Object | false | Set true to enable WebHook or set options |
| [telegram_options.webHook.host] | String | "0.0.0.0" | Host to bind to |
| [telegram_options.webHook.port] | Number | 8443 | Port to bind to |
| [telegram_options.webHook.key] | String | Path to file with PEM private key for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.cert] | String | Path to file with PEM certificate (public) for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.pfx] | String | Path to file with PFX private key and certificate chain for webHook server. The file is read synchronously! | |
| [telegram_options.webHook.autoOpen] | Boolean | true | Open webHook immediately |
| [telegram_options.webHook.https] | Object | Options to be passed to https.createServer(). Note that options.webHook.key, options.webHook.cert and options.webHook.pfx, if provided, will be used to override key, cert and pfx in this object, respectively. See https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener for more information. | |
| [telegram_options.webHook.healthEndpoint] | String | "/healthz" | An endpoint for health checks that always responds with 200 OK |
| [telegram_options.onlyFirstMatch] | Boolean | false | Set to true to stop after first match. Otherwise, all regexps are executed |
| [telegram_options.request] | Object | Options which will be added for all requests to telegram api. See https://github.com/request/request#requestoptions-callback for more information. | |
| [telegram_options.baseApiUrl] | String | "https://api.telegram.org" | API Base URl; useful for proxying and testing |
| [telegram_options.filepath] | Boolean | true | Allow passing file-paths as arguments when sending files, such as photos using TelegramBot#sendPhoto(). See [usage information][usage-sending-files-performance] for more information on this option and its consequences. |
| [telegram_options.badRejection] | Boolean | false | Set to true if and only if the Node.js version you're using terminates the process on unhandled rejections. This option is only for forward-compatibility purposes. |
| [options] | Object | ||
| [options.language] | String | "en" | Language. |
| [options.size] | Number | 4 | Captcha length < 9 (number of characters). |
| [options.time_for_enter] | Number | 5 | Time for enter captcha (in minutes). |
captcha.generateCaptcha(cjr)
Generating and sending a calendar to the user. Sets the current month and year.
Kind: instance method of GroupCaptchaRTJ
| Param | Type | Description |
|---|---|---|
| cjr | Object | https://core.telegram.org/bots/api#chatjoinrequest |
captcha.clickKeyboard(query)
Generating and sending a time selector to the user.
Kind: instance method of GroupCaptchaRTJ
| Param | Type | Description |
|---|---|---|
| query | Object | https://core.telegram.org/bots/api#callbackquery |