API.md

April 11, 2023 ยท View on GitHub

API Reference

GroupCaptcha

Captcha for open groups.

Kind: global class

new GroupCaptcha(bot, [options])

ParamTypeDefaultDescription
tokenStringBot Token
[telegram_options]Object
[telegram_options.polling]Boolean | ObjectfalseSet true to enable polling or set options. If a WebHook has been set, it will be deleted automatically.
[telegram_options.polling.timeout]String | Number10Deprecated. Use options.polling.params instead. Timeout in seconds for long polling.
[telegram_options.testEnvironment]BooleanfalseSet 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 | Number300Interval between requests in miliseconds
[telegram_options.polling.autoStart]BooleantrueStart polling immediately
[telegram_options.polling.params]ObjectParameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information.
[telegram_options.polling.params.timeout]Number10Timeout in seconds for long polling.
[telegram_options.webHook]Boolean | ObjectfalseSet true to enable WebHook or set options
[telegram_options.webHook.host]String"0.0.0.0"Host to bind to
[telegram_options.webHook.port]Number8443Port to bind to
[telegram_options.webHook.key]StringPath to file with PEM private key for webHook server. The file is read synchronously!
[telegram_options.webHook.cert]StringPath to file with PEM certificate (public) for webHook server. The file is read synchronously!
[telegram_options.webHook.pfx]StringPath to file with PFX private key and certificate chain for webHook server. The file is read synchronously!
[telegram_options.webHook.autoOpen]BooleantrueOpen webHook immediately
[telegram_options.webHook.https]ObjectOptions 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]BooleanfalseSet to true to stop after first match. Otherwise, all regexps are executed
[telegram_options.request]ObjectOptions 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]BooleantrueAllow 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]BooleanfalseSet 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]Number4Captcha length < 9 (number of characters).
[options.time_for_enter]Number5Time 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

ParamTypeDescription
msgObjecthttps://core.telegram.org/bots/api#message

captcha.clickKeyboard(query)

Generating and sending a time selector to the user.

Kind: instance method of GroupCaptcha

ParamTypeDescription
queryObjecthttps://core.telegram.org/bots/api#callbackquery

GroupCaptchaRTJ

Captcha for groups with requests to join.

Kind: global class

new GroupCaptchaRTJ(bot, [options])

ParamTypeDefaultDescription
tokenStringBot Token
[telegram_options]Object
[telegram_options.polling]Boolean | ObjectfalseSet true to enable polling or set options. If a WebHook has been set, it will be deleted automatically.
[telegram_options.polling.timeout]String | Number10Deprecated. Use options.polling.params instead. Timeout in seconds for long polling.
[telegram_options.testEnvironment]BooleanfalseSet 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 | Number300Interval between requests in miliseconds
[telegram_options.polling.autoStart]BooleantrueStart polling immediately
[telegram_options.polling.params]ObjectParameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information.
[telegram_options.polling.params.timeout]Number10Timeout in seconds for long polling.
[telegram_options.webHook]Boolean | ObjectfalseSet true to enable WebHook or set options
[telegram_options.webHook.host]String"0.0.0.0"Host to bind to
[telegram_options.webHook.port]Number8443Port to bind to
[telegram_options.webHook.key]StringPath to file with PEM private key for webHook server. The file is read synchronously!
[telegram_options.webHook.cert]StringPath to file with PEM certificate (public) for webHook server. The file is read synchronously!
[telegram_options.webHook.pfx]StringPath to file with PFX private key and certificate chain for webHook server. The file is read synchronously!
[telegram_options.webHook.autoOpen]BooleantrueOpen webHook immediately
[telegram_options.webHook.https]ObjectOptions 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]BooleanfalseSet to true to stop after first match. Otherwise, all regexps are executed
[telegram_options.request]ObjectOptions 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]BooleantrueAllow 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]BooleanfalseSet 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]Number4Captcha length < 9 (number of characters).
[options.time_for_enter]Number5Time 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

ParamTypeDescription
cjrObjecthttps://core.telegram.org/bots/api#chatjoinrequest

captcha.clickKeyboard(query)

Generating and sending a time selector to the user.

Kind: instance method of GroupCaptchaRTJ

ParamTypeDescription
queryObjecthttps://core.telegram.org/bots/api#callbackquery