2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-28 21:07:39 +00:00

Bot API 5.1: Support Improved Invite Links and new messageTypes (#859)

* Add new method sendPoll

* getMyCommands

* setMyCommands

* Update doc/api

* 1# Fix Test sendPhoto

The sendPhoto method does not support .gif files, use sendAnimation.

This fix remplace .gif file by .png

* CustomTitle and ChatPermissions support

setChatAdministratorCustomTitle
setChatPermissions

* Update Readme

Update Badge Telegram API Version

* Minor Fix and Fix setChatPhoto

The Telegram Bots api has a bug that they are fixing and gives problems with the previous image. While they don't fix it, the image replacement is the fastest solution

* Minor Fix and Add Test

Fixed setChatPermissions

Test:
- sendDice
- getMyCommands
- setMyCommands
- setChatAdministratorCustomTitle
- setChatPermissions

* Update Changelog and Package.json version

* Fix typos in Changelog

* Add support for poll_answer

From: https://github.com/yagop/node-telegram-bot-api/pull/777

* Add JieJiSS contribution in Changelog

* Add sendPoll Test

* Add unpinAllChatMessages Support

* Add copyMessage support

* Add close and logOut Support

* Add Test + Minor fixes

* Update CHANGELOG

Update version 0.50.1

* Update Readme Bot API Badge

* Update Version to 0.51.0

* Bot API 5.1 support Improved Invite Links

- Added the method createChatInviteLink
- Added the method editChatInviteLink
- Added the method revokeChatInviteLink

* Update version to 0.52.0 and new tests

- Update Changelog
- New Test
- Update version to 0.52.0

* Add new messageTypes

-  voice_chat_started
-  voice_chat_ended
- voice_chat_participants_invited

* Update Changelog and add new MessageType

* New messageTypes and updates

Add support for new messageTypes:
  - chat_invite_link
  - chat_member_updated

Add support for new updates:
 - my_chat_member
 - chat_member
This commit is contained in:
Daniel Pérez Fernández 2021-03-29 16:37:10 +02:00 committed by GitHub
parent 28cd62e355
commit de76dcd2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 563 additions and 552 deletions

View File

@ -3,52 +3,82 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [0.52.0][0.52.0] - 2021-03-20
Added:
1. Support Bot API v5.1: (by @danielperez9430)
* Add method *createChatInviteLink()*
* Add method *editChatInviteLink()*
* Add method *revokeChatInviteLink()*
* Add support for new messageTypes:
* *voice_chat_started*
* *voice_chat_ended*
* *voice_chat_participants_invited*
* *message_auto_delete_timer_changed*
* *chat_invite_link*
* *chat_member_updated*
* Add support for new updates:
* *my_chat_member*
* *chat_member*
New Test: (by @danielperez9430)
* createChatInviteLink
* editChatInviteLink
* revokeChatInviteLink
## [0.51.0][0.51.0] - 2020-11-04 ## [0.51.0][0.51.0] - 2020-11-04
Added: Added:
1. Support Bot API v5.0: (by @danielperez9430) 1. Support Bot API v5.0: (by @danielperez9430)
* Add method *copyMessage()* * Add method *copyMessage()*
* Add method *unpinAllChatMessages()* * Add method *unpinAllChatMessages()*
* Add method *close()* * Add method *close()*
* Add method *logOut()* * Add method *logOut()*
Changed: (by @danielperez9430) Changed: (by @danielperez9430)
* Remove trailing-spaces * Remove trailing-spaces
* Fix Bugs in Test * Fix Bugs in Test
New Test: (by @danielperez9430) New Test: (by @danielperez9430)
* copyMessage * copyMessage
* unpinAllChatMessages * unpinAllChatMessages
## [0.50.0][0.50.0] - 2020-05-2020 ## [0.50.0][0.50.0] - 2020-05-2020
Added: Added:
1. Support Bot API v4.8: (by @danielperez9430) 1. Support Bot API v4.8: (by @danielperez9430)
* Add methods: *sendDice()* * Add methods: *sendDice()*
1. Support Bot API v4.7: (by @danielperez9430) 2. Support Bot API v4.7: (by @danielperez9430)
* Add methods: *getMyCommands()*,*setMyCommands()* * Add methods: *getMyCommands()*,*setMyCommands()*
1. Support Bot API v4.5: (by @danielperez9430) 3. Support Bot API v4.5: (by @danielperez9430)
* Add methods: *setChatAdministratorCustomTitle()* * Add methods: *setChatAdministratorCustomTitle()*
1. Support Bot API v4.4: (by @danielperez9430) 4. Support Bot API v4.4: (by @danielperez9430)
* Add methods: *setChatPermissions()* * Add methods: *setChatPermissions()*
1. Support for poll_answer (by @JieJiSS) 5. Support for poll_answer (by @JieJiSS)
1. Add request options in file stream (by @zhangpanyi ) 6. Add request options in file stream (by @zhangpanyi )
Changed: (by @danielperez9430) Changed: (by @danielperez9430)
* New message type: *dice*
* Fix Bugs in tests * New message type: *dice*
* Fix regex compare (by @ledamint) * Fix Bugs in tests
* Fix listening for error events when downloading files (by @Kraigo) * Fix regex compare (by @ledamint)
* Fix listening for error events when downloading files (by @Kraigo)
New Test: (by @danielperez9430) New Test: (by @danielperez9430)
* sendDice
* getMyCommands * sendDice
* setMyCommands * getMyCommands
* setChatAdministratorCustomTitle * setMyCommands
* setChatPermissions * setChatAdministratorCustomTitle
* setChatPermissions
## [0.40.0][0.40.0] - 2019-05-04 ## [0.40.0][0.40.0] - 2019-05-04
@ -57,11 +87,10 @@ Added:
1. Support Bot API v4.2: (by @kamikazechaser) 1. Support Bot API v4.2: (by @kamikazechaser)
* Add methods: *TelegramBot#sendPoll()*, *TelegramBot#stopPoll()* * Add methods: *TelegramBot#sendPoll()*, *TelegramBot#stopPoll()*
* Support events: *poll* * Support events: *poll*
1. Support Bot API v4.0: (by @kamikazechaser) 2. Support Bot API v4.0: (by @kamikazechaser)
* Add methods: *TelegramBot#editMessageMedia()*, *TelegramBot#sendAnimation()* * Add methods: *TelegramBot#editMessageMedia()*, *TelegramBot#sendAnimation()*
* Support new message types: *passport_data*, *animation* * Support new message types: *passport_data*, *animation*
* * * * * *
## [0.30.0][0.30.0] - 2017-12-21 ## [0.30.0][0.30.0] - 2017-12-21
@ -71,22 +100,22 @@ Added:
1. Support Bot API v3.5: (by @GochoMugo) 1. Support Bot API v3.5: (by @GochoMugo)
* Allow `provider_data` parameter in *TelegramBot#sendInvoice* * Allow `provider_data` parameter in *TelegramBot#sendInvoice*
* Add method *TelegramBot#sendMediaGroup()* * Add method *TelegramBot#sendMediaGroup()*
1. Support Bot API v3.4: (by @kamikazechaser) 2. Support Bot API v3.4: (by @kamikazechaser)
* Add methods *TelegramBot#editMessageLiveLocation*, *TelegramBot#stopMessageLiveLocation* (#439) * Add methods *TelegramBot#editMessageLiveLocation*, *TelegramBot#stopMessageLiveLocation* (#439)
* Add methods *TelegramBot#setChatStickerSet*, *TelegramBot#deleteChatStickerSet* (#440) * Add methods *TelegramBot#setChatStickerSet*, *TelegramBot#deleteChatStickerSet* (#440)
1. Add methods: 3. Add methods:
* *TelegramBot#getFileStream* (#442) (by @GochoMugo, requested-by @Xaqron) * *TelegramBot#getFileStream* (#442) (by @GochoMugo, requested-by @Xaqron)
1. Add options to *TelegramBot#stopPolling()* (by @GochoMugo) 4. Add options to *TelegramBot#stopPolling()* (by @GochoMugo)
1. Add `metadata` argument in `message` event (and friends e.g. `text`, `audio`, etc.) (#409) (by @jlsjonas, @GochoMugo) 5. Add `metadata` argument in `message` event (and friends e.g. `text`, `audio`, etc.) (#409) (by @jlsjonas, @GochoMugo)
1. Add forward-compatibility i.e. support future additional Telegram options (by @GochoMugo) 6. Add forward-compatibility i.e. support future additional Telegram options (by @GochoMugo)
1. Add support for Node.js v9 (by @GochoMugo) 7. Add support for Node.js v9 (by @GochoMugo)
1. Document *TelegramBot.errors*, *TelegramBot.messageTypes* (by @GochoMugo) 8. Document *TelegramBot.errors*, *TelegramBot.messageTypes* (by @GochoMugo)
Changed: Changed:
1. Update *TelegramBot#answerCallbackQuery()* signature (by @GochoMugo) 1. Update *TelegramBot#answerCallbackQuery()* signature (by @GochoMugo)
1. Improve default error logging of `polling_error` and `webhook_error` (#377) 2. Improve default error logging of `polling_error` and `webhook_error` (#377)
1. Update dependencies 3. Update dependencies
Deprecated: Deprecated:
@ -98,8 +127,7 @@ Deprecated:
Fixed: Fixed:
1. Fix the offset infinite loop bug (#265, #36) (by @GochoMugo) 1. Fix the offset infinite loop bug (#265, #36) (by @GochoMugo)
1. Fix game example (#449, #418) (by @MCSH) 2. Fix game example (#449, #418) (by @MCSH)
* * * * * *
@ -111,13 +139,12 @@ Added:
* (#429) *TelegramBot#getStickerSet* (by @CapacitorSet, @LibertyLocked) * (#429) *TelegramBot#getStickerSet* (by @CapacitorSet, @LibertyLocked)
* (#430) *TelegramBot#uploadStickerFile* (by @CapacitorSet) * (#430) *TelegramBot#uploadStickerFile* (by @CapacitorSet)
* *TelegramBot#createNewStickerSet*, *TelegramBot#addStickerToSet*, *TelegramBot#setStickerPositionInSet*, *TelegramBot#deleteStickerFromSet* (by @GochoMugo) * *TelegramBot#createNewStickerSet*, *TelegramBot#addStickerToSet*, *TelegramBot#setStickerPositionInSet*, *TelegramBot#deleteStickerFromSet* (by @GochoMugo)
1. Supports API v3.3 2. Supports API v3.3
Deprecated: Deprecated:
1. Auto-enabling Promise cancellation (#319) (by @GochoMugo) 1. Auto-enabling Promise cancellation (#319) (by @GochoMugo)
* * * * * *
## [0.28.0][0.28.0] - 2017-08-06 ## [0.28.0][0.28.0] - 2017-08-06
@ -125,10 +152,10 @@ Deprecated:
Added: Added:
1. (#361) Support Bot API v3.1 (by @Lord-Protector, @kamikazechaser) 1. (#361) Support Bot API v3.1 (by @Lord-Protector, @kamikazechaser)
1. (#332) Support Bot API v3.0 (by @kamikazechaser, @GochoMugo) 2. (#332) Support Bot API v3.0 (by @kamikazechaser, @GochoMugo)
1. Add *TelegramBot#removeTextListener()* (by @GochoMugo) 3. Add *TelegramBot#removeTextListener()* (by @GochoMugo)
1. (#342) Add game example (by @MCSH) 4. (#342) Add game example (by @MCSH)
1. (#315) List 'bot-brother' project in community section in README (by @saeedhei) 5. (#315) List 'bot-brother' project in community section in README (by @saeedhei)
Changed: Changed:
@ -137,9 +164,8 @@ Changed:
Fixed: Fixed:
1. (#325) Fix global regexp state reset (by @Sirius-A) 1. (#325) Fix global regexp state reset (by @Sirius-A)
1. (#363) Fix download file path on windows (by @kucherenkovova) 2. (#363) Fix download file path on windows (by @kucherenkovova)
1. (#346) Fix anchor webhook link in docs (by @Coac) 3. (#346) Fix anchor webhook link in docs (by @Coac)
* * * * * *
@ -149,15 +175,13 @@ Added:
1. (#287) Add Express WebHook example (by @kamikazechaser) 1. (#287) Add Express WebHook example (by @kamikazechaser)
Fixed: Fixed:
1. (#291) Improve docs (by @preco21) 1. (#291) Improve docs (by @preco21)
1. (#298) Fix running on Node v5 (by @jehy) 2. (#298) Fix running on Node v5 (by @jehy)
1. (#307) Fix badge links in README (by @JaakkoLipsanen) 3. (#307) Fix badge links in README (by @JaakkoLipsanen)
1. Fix defaulting value of `options.polling.params.timeout` (by @GochoMugo) 4. Fix defaulting value of `options.polling.params.timeout` (by @GochoMugo)
1. Fix typos in Github issue template (by @GochoMugo, requested-by @GingerPlusPlus) 5. Fix typos in Github issue template (by @GochoMugo, requested-by @GingerPlusPlus)
* * * * * *
@ -167,16 +191,16 @@ Added:
1. Add constructor options: 1. Add constructor options:
* (#243) `options.polling.params` (by @GochoMugo, requested-by @sidelux) * (#243) `options.polling.params` (by @GochoMugo, requested-by @sidelux)
1. Add methods: 2. Add methods:
* (#74) *TelegramBot#removeReplyListener()* (by @githugger) * (#74) *TelegramBot#removeReplyListener()* (by @githugger)
1. (#283) Add proper error handling (by @GochoMugo) 3. (#283) Add proper error handling (by @GochoMugo)
1. (#272) Add health-check endpoint (by @mironov) 4. (#272) Add health-check endpoint (by @mironov)
* `options.webHook.healthEndpoint` * `options.webHook.healthEndpoint`
1. (#152) Add test for TelegramBot#sendDocument() using 'fileOpts' 5. (#152) Add test for TelegramBot#sendDocument() using 'fileOpts'
param (by @evolun) param (by @evolun)
1. Document `options.webHook.host` (by @GochoMugo) 6. Document `options.webHook.host` (by @GochoMugo)
1. (#264) Add Bot API version to README (by @kamikazechaser) 7. (#264) Add Bot API version to README (by @kamikazechaser)
1. Add examples: 8. Add examples:
- (#271) WebHook on Heroku (by @TheBeastOfCaerbannog) - (#271) WebHook on Heroku (by @TheBeastOfCaerbannog)
- (#274) WebHook on Zeit Now (by @Ferrari) - (#274) WebHook on Zeit Now (by @Ferrari)
@ -197,7 +221,6 @@ Fixed:
polling (by @GochoMugo, reported-by @dcparga) polling (by @GochoMugo, reported-by @dcparga)
1. Fix links in documentation (by @Ni2c2k) 1. Fix links in documentation (by @Ni2c2k)
* * * * * *
## [0.26.0][0.26.0] - 2017-01-20 ## [0.26.0][0.26.0] - 2017-01-20
@ -208,7 +231,7 @@ Added:
* `options.https` * `options.https`
* `options.baseApiUrl` * `options.baseApiUrl`
* `options.filepath` * `options.filepath`
1. Add methods: 2. Add methods:
* *TelegramBot#stopPolling()* * *TelegramBot#stopPolling()*
* *TelegramBot#isPolling()* * *TelegramBot#isPolling()*
* *TelegramBot#openWebHook()* * *TelegramBot#openWebHook()*
@ -220,17 +243,17 @@ Added:
Changed: Changed:
1. Use POST requests by default 1. Use POST requests by default
1. Ensure all relevant methods return Promises 2. Ensure all relevant methods return Promises
1. Document auto-deletion of webhook during polling 3. Document auto-deletion of webhook during polling
1. Deprecate support for Node.js v0.12 4. Deprecate support for Node.js v0.12
1. Fix consistency of methods signatures 5. Fix consistency of methods signatures
1. Rename *TelegramBot#initPolling()* to *TelegramBot#startPolling()* 6. Rename *TelegramBot#initPolling()* to *TelegramBot#startPolling()*
* Deprecate *TelegramBot#initPolling()* * Deprecate *TelegramBot#initPolling()*
Fixed: Fixed:
1. Handle error during formatting `formData` 1. Handle error during formatting `formData`
1. Fix ES6 syntax 2. Fix ES6 syntax
*Credits/Blames: Unless explicitly stated otherwise, above work was *Credits/Blames: Unless explicitly stated otherwise, above work was
done by @GochoMugo* done by @GochoMugo*
@ -242,10 +265,10 @@ done by @GochoMugo*
Added: Added:
1. Supports the API v2.3 updates (by @kamikazechaser) 1. Supports the API v2.3 updates (by @kamikazechaser)
1. Add *TelegramBot* constructor option: 2. Add *TelegramBot* constructor option:
* `options.request`: proxy extra request options (by @tarmolov) * `options.request`: proxy extra request options (by @tarmolov)
* `options.onlyFirstMatch` (by @GingerPlusPlus) * `options.onlyFirstMatch` (by @GingerPlusPlus)
1. Add methods: 3. Add methods:
* *TelegramBot#sendVenue()* (by Tketa) * *TelegramBot#sendVenue()* (by Tketa)
* *TelegramBot#sendContact()* (by @GochoMugo) * *TelegramBot#sendContact()* (by @GochoMugo)
* *TelegramBot#getGameHighScores()* (by @jishnu7) * *TelegramBot#getGameHighScores()* (by @jishnu7)
@ -253,8 +276,7 @@ Added:
Fixed: Fixed:
1. Fix request performance issue (by @preco21) 1. Fix request performance issue (by @preco21)
1. Fix typos (by oflisback) 2. Fix typos (by oflisback)
[usage-sending-files]:https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files-options [usage-sending-files]:https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files-options

View File

@ -4,7 +4,7 @@
Node.js module to interact with the official [Telegram Bot API](https://core.telegram.org/bots/api). Node.js module to interact with the official [Telegram Bot API](https://core.telegram.org/bots/api).
[![Bot API](https://img.shields.io/badge/Bot%20API-v.5.0-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![Bot API](https://img.shields.io/badge/Bot%20API-v.5.1-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![npm package](https://img.shields.io/npm/v/node-telegram-bot-api?logo=npm&style=flat-square)](https://www.npmjs.org/package/node-telegram-bot-api) [![npm package](https://img.shields.io/npm/v/node-telegram-bot-api?logo=npm&style=flat-square)](https://www.npmjs.org/package/node-telegram-bot-api)
[![Build Status](https://img.shields.io/travis/yagop/node-telegram-bot-api/master?style=flat-square&logo=travis)](https://travis-ci.org/yagop/node-telegram-bot-api) [![Build Status](https://img.shields.io/travis/yagop/node-telegram-bot-api/master?style=flat-square&logo=travis)](https://travis-ci.org/yagop/node-telegram-bot-api)
[![Coverage Status](https://img.shields.io/codecov/c/github/yagop/node-telegram-bot-api?style=flat-square&logo=codecov)](https://codecov.io/gh/yagop/node-telegram-bot-api) [![Coverage Status](https://img.shields.io/codecov/c/github/yagop/node-telegram-bot-api?style=flat-square&logo=codecov)](https://codecov.io/gh/yagop/node-telegram-bot-api)

View File

@ -35,6 +35,7 @@ TelegramBot
* [.copyMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+copyMessage) ⇒ <code>Promise</code> * [.copyMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+copyMessage) ⇒ <code>Promise</code>
* [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code> * [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
* [.sendAudio(chatId, audio, [options], [fileOptions])](#TelegramBot+sendAudio) ⇒ <code>Promise</code> * [.sendAudio(chatId, audio, [options], [fileOptions])](#TelegramBot+sendAudio) ⇒ <code>Promise</code>
* [.sendDice(chatId, [options])](#TelegramBot+sendDice) ⇒ <code>Promise</code>
* [.sendDocument(chatId, doc, [options], [fileOptions])](#TelegramBot+sendDocument) ⇒ <code>Promise</code> * [.sendDocument(chatId, doc, [options], [fileOptions])](#TelegramBot+sendDocument) ⇒ <code>Promise</code>
* [.sendSticker(chatId, sticker, [options], [fileOptions])](#TelegramBot+sendSticker) ⇒ <code>Promise</code> * [.sendSticker(chatId, sticker, [options], [fileOptions])](#TelegramBot+sendSticker) ⇒ <code>Promise</code>
* [.sendVideo(chatId, video, [options], [fileOptions])](#TelegramBot+sendVideo) ⇒ <code>Promise</code> * [.sendVideo(chatId, video, [options], [fileOptions])](#TelegramBot+sendVideo) ⇒ <code>Promise</code>
@ -47,8 +48,11 @@ TelegramBot
* [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ <code>Promise</code> * [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ <code>Promise</code>
* [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ <code>Promise</code> * [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ <code>Promise</code>
* [.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options])](#TelegramBot+setChatAdministratorCustomTitle) ⇒ <code>Promise</code> * [.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options])](#TelegramBot+setChatAdministratorCustomTitle) ⇒ <code>Promise</code>
* [.setChatPermissions(chatId, ChatPermissions, [options])](#TelegramBot+setChatPermissions) ⇒ <code>Promise</code> * [.setChatPermissions(chatId, chatPermissions, [options])](#TelegramBot+setChatPermissions) ⇒ <code>Promise</code>
* [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ <code>Promise</code> * [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ <code>Promise</code>
* [.createChatInviteLink(chatId, [options])](#TelegramBot+createChatInviteLink) ⇒ <code>Object</code>
* [.editChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+editChatInviteLink) ⇒ <code>Object</code>
* [.revokeChatInviteLink(chatId, [options])](#TelegramBot+revokeChatInviteLink) ⇒ <code>Object</code>
* [.setChatPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+setChatPhoto) ⇒ <code>Promise</code> * [.setChatPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+setChatPhoto) ⇒ <code>Promise</code>
* [.deleteChatPhoto(chatId, [options])](#TelegramBot+deleteChatPhoto) ⇒ <code>Promise</code> * [.deleteChatPhoto(chatId, [options])](#TelegramBot+deleteChatPhoto) ⇒ <code>Promise</code>
* [.setChatTitle(chatId, title, [options])](#TelegramBot+setChatTitle) ⇒ <code>Promise</code> * [.setChatTitle(chatId, title, [options])](#TelegramBot+setChatTitle) ⇒ <code>Promise</code>
@ -71,16 +75,15 @@ TelegramBot
* [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code> * [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code>
* [.sendPoll(chatId, question, pollOptions, [options])](#TelegramBot+sendPoll) ⇒ <code>Promise</code> * [.sendPoll(chatId, question, pollOptions, [options])](#TelegramBot+sendPoll) ⇒ <code>Promise</code>
* [.stopPoll(chatId, pollId, [options])](#TelegramBot+stopPoll) ⇒ <code>Promise</code> * [.stopPoll(chatId, pollId, [options])](#TelegramBot+stopPoll) ⇒ <code>Promise</code>
* [.sendDice(chatId, [options])](#TelegramBot+sendDice) ⇒ <code>Promise</code>
* [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ <code>Promise</code> * [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ <code>Promise</code>
* [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ <code>Promise</code> * [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ <code>Promise</code>
* [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ <code>stream.Readable</code> * [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ <code>stream.Readable</code>
* [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ <code>Promise</code> * [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
* [.onText(regexp, callback)](#TelegramBot+onText) * [.onText(regexp, callback)](#TelegramBot+onText)
* [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ <code>Object</code> * [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ <code>Object</code>
* [.clearTextListeners()](#TelegramBot+clearTextListeners)
* [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) ⇒ <code>Number</code> * [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) ⇒ <code>Number</code>
* [.removeReplyListener(replyListenerId)](#TelegramBot+removeReplyListener) ⇒ <code>Object</code> * [.removeReplyListener(replyListenerId)](#TelegramBot+removeReplyListener) ⇒ <code>Object</code>
* [.clearTextListeners()](#TelegramBot+clearTextListeners)
* [.clearReplyListeners()](#TelegramBot+clearReplyListeners) * [.clearReplyListeners()](#TelegramBot+clearReplyListeners)
* [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ <code>Promise</code> * [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ <code>Promise</code>
* [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code> * [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code>
@ -105,15 +108,13 @@ TelegramBot
* [.sendMediaGroup(chatId, media, [options])](#TelegramBot+sendMediaGroup) ⇒ <code>Promise</code> * [.sendMediaGroup(chatId, media, [options])](#TelegramBot+sendMediaGroup) ⇒ <code>Promise</code>
* _static_ * _static_
* [.errors](#TelegramBot.errors) : <code>Object</code> * [.errors](#TelegramBot.errors) : <code>Object</code>
* [.messageTypes](#TelegramBot.messageTypes) : <code>Array.&lt;String&gt;</code> * [.messageTypes](#TelegramBot.messageTypes) : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code>
* [.Promise](#TelegramBot.Promise) * [.Promise](#TelegramBot.Promise)
<a name="new_TelegramBot_new"></a> <a name="new_TelegramBot_new"></a>
### new TelegramBot(token, [options]) ### new TelegramBot(token, [options])
Both request method to obtain messages are implemented. To use standard polling, set `polling: true` Both request method to obtain messages are implemented. To use standard polling, set `polling: true` on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate. Emits `message` when a message arrives.
on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
Emits `message` when a message arrives.
| Param | Type | Default | Description | | Param | Type | Default | Description |
@ -144,8 +145,7 @@ Emits `message` when a message arrives.
<a name="TelegramBot+on"></a> <a name="TelegramBot+on"></a>
### telegramBot.on(event, listener) ### telegramBot.on(event, listener)
Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events). Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events). This is the usual `emitter.on()` method.
This is the usual `emitter.on()` method.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See** **See**
@ -162,8 +162,7 @@ This is the usual `emitter.on()` method.
<a name="TelegramBot+startPolling"></a> <a name="TelegramBot+startPolling"></a>
### telegramBot.startPolling([options]) ⇒ <code>Promise</code> ### telegramBot.startPolling([options]) ⇒ <code>Promise</code>
Start polling. Start polling. Rejects returned promise if a WebHook is being used by this instance.
Rejects returned promise if a WebHook is being used by this instance.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
@ -188,9 +187,7 @@ Alias of `TelegramBot#startPolling()`. This is **deprecated**.
<a name="TelegramBot+stopPolling"></a> <a name="TelegramBot+stopPolling"></a>
### telegramBot.stopPolling([options]) ⇒ <code>Promise</code> ### telegramBot.stopPolling([options]) ⇒ <code>Promise</code>
Stops polling after the last polling request resolves. Stops polling after the last polling request resolves. Multiple invocations do nothing if polling is already stopped. Returning the promise of the last polling request is **deprecated**.
Multiple invocations do nothing if polling is already stopped.
Returning the promise of the last polling request is **deprecated**.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
@ -209,24 +206,20 @@ Return true if polling. Otherwise, false.
<a name="TelegramBot+openWebHook"></a> <a name="TelegramBot+openWebHook"></a>
### telegramBot.openWebHook() ⇒ <code>Promise</code> ### telegramBot.openWebHook() ⇒ <code>Promise</code>
Open webhook. Open webhook. Multiple invocations do nothing if webhook is already open. Rejects returned promise if Polling is being used by this instance.
Multiple invocations do nothing if webhook is already open.
Rejects returned promise if Polling is being used by this instance.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot+closeWebHook"></a> <a name="TelegramBot+closeWebHook"></a>
### telegramBot.closeWebHook() ⇒ <code>Promise</code> ### telegramBot.closeWebHook() ⇒ <code>Promise</code>
Close webhook after closing all current connections. Close webhook after closing all current connections. Multiple invocations do nothing if webhook is already closed.
Multiple invocations do nothing if webhook is already closed.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - promise **Returns**: <code>Promise</code> - promise
<a name="TelegramBot+hasOpenWebHook"></a> <a name="TelegramBot+hasOpenWebHook"></a>
### telegramBot.hasOpenWebHook() ⇒ <code>Boolean</code> ### telegramBot.hasOpenWebHook() ⇒ <code>Boolean</code>
Return true if using webhook and it is open i.e. accepts connections. Return true if using webhook and it is open i.e. accepts connections. Otherwise, false.
Otherwise, false.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot+getMe"></a> <a name="TelegramBot+getMe"></a>
@ -244,10 +237,7 @@ Returns basic information about the bot in form of a `User` object.
<a name="TelegramBot+logOut"></a> <a name="TelegramBot+logOut"></a>
### telegramBot.logOut([options]) ⇒ <code>Promise</code> ### telegramBot.logOut([options]) ⇒ <code>Promise</code>
This method log out your bot from the cloud Bot API server before launching the bot locally. This method log out your bot from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you will not be able to log in again using the same token for 10 minutes. Returns True on success.
You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates.
After a successful call, you will not be able to log in again using the same token for 10 minutes.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#logout **See**: https://core.telegram.org/bots/api#logout
@ -259,9 +249,7 @@ Returns True on success.
<a name="TelegramBot+close"></a> <a name="TelegramBot+close"></a>
### telegramBot.close([options]) ⇒ <code>Promise</code> ### telegramBot.close([options]) ⇒ <code>Promise</code>
This method close the bot instance before moving it from one local server to another. This method close the bot instance before moving it from one local server to another. This method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success.
This method will return error 429 in the first 10 minutes after the bot is launched.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#close **See**: https://core.telegram.org/bots/api#close
@ -273,9 +261,7 @@ Returns True on success.
<a name="TelegramBot+setWebHook"></a> <a name="TelegramBot+setWebHook"></a>
### telegramBot.setWebHook(url, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.setWebHook(url, [options], [fileOptions]) ⇒ <code>Promise</code>
Specify an url to receive incoming updates via an outgoing webHook. Specify an url to receive incoming updates via an outgoing webHook. This method has an [older, compatible signature][setWebHook-v0.25.0] that is being deprecated.
This method has an [older, compatible signature][setWebHook-v0.25.0]
that is being deprecated.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See** **See**
@ -294,8 +280,7 @@ that is being deprecated.
<a name="TelegramBot+deleteWebHook"></a> <a name="TelegramBot+deleteWebHook"></a>
### telegramBot.deleteWebHook([options]) ⇒ <code>Promise</code> ### telegramBot.deleteWebHook([options]) ⇒ <code>Promise</code>
Use this method to remove webhook integration if you decide to Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.
switch back to getUpdates. Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#deletewebhook **See**: https://core.telegram.org/bots/api#deletewebhook
@ -307,10 +292,7 @@ switch back to getUpdates. Returns True on success.
<a name="TelegramBot+getWebHookInfo"></a> <a name="TelegramBot+getWebHookInfo"></a>
### telegramBot.getWebHookInfo([options]) ⇒ <code>Promise</code> ### telegramBot.getWebHookInfo([options]) ⇒ <code>Promise</code>
Use this method to get current webhook status. Use this method to get current webhook status. On success, returns a [WebhookInfo](https://core.telegram.org/bots/api#webhookinfo) object. If the bot is using getUpdates, will return an object with the url field empty.
On success, returns a [WebhookInfo](https://core.telegram.org/bots/api#webhookinfo) object.
If the bot is using getUpdates, will return an object with the
url field empty.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getwebhookinfo **See**: https://core.telegram.org/bots/api#getwebhookinfo
@ -322,9 +304,7 @@ url field empty.
<a name="TelegramBot+getUpdates"></a> <a name="TelegramBot+getUpdates"></a>
### telegramBot.getUpdates([options]) ⇒ <code>Promise</code> ### telegramBot.getUpdates([options]) ⇒ <code>Promise</code>
Use this method to receive incoming updates using long polling. Use this method to receive incoming updates using long polling. This method has an [older, compatible signature][getUpdates-v0.25.0] that is being deprecated.
This method has an [older, compatible signature][getUpdates-v0.25.0]
that is being deprecated.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getupdates **See**: https://core.telegram.org/bots/api#getupdates
@ -336,9 +316,7 @@ that is being deprecated.
<a name="TelegramBot+processUpdate"></a> <a name="TelegramBot+processUpdate"></a>
### telegramBot.processUpdate(update) ### telegramBot.processUpdate(update)
Process an update; emitting the proper events and executing regexp Process an update; emitting the proper events and executing regexp callbacks. This method is useful should you be using a different way to fetch updates, other than those provided by TelegramBot.
callbacks. This method is useful should you be using a different
way to fetch updates, other than those provided by TelegramBot.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#update **See**: https://core.telegram.org/bots/api#update
@ -372,7 +350,7 @@ Send answers to an inline query.
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| inlineQueryId | <code>String</code> | Unique identifier of the query | | inlineQueryId | <code>String</code> | Unique identifier of the query |
| results | <code>Array.&lt;InlineQueryResult&gt;</code> | An array of results for the inline query | | results | <code>[ &#x27;Array&#x27; ].&lt;InlineQueryResult&gt;</code> | An array of results for the inline query |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+forwardMessage"></a> <a name="TelegramBot+forwardMessage"></a>
@ -381,6 +359,7 @@ Send answers to an inline query.
Forward messages of any kind. Forward messages of any kind.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#forwardmessage
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
@ -392,9 +371,10 @@ Forward messages of any kind.
<a name="TelegramBot+copyMessage"></a> <a name="TelegramBot+copyMessage"></a>
### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code> ### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code>
Copy messages of any kind. Copy messages of any kind. The method is analogous to the method forwardMessages, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#copymessage
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
@ -441,6 +421,19 @@ Send audio
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
| [fileOptions] | <code>Object</code> | Optional file related meta-data | | [fileOptions] | <code>Object</code> | Optional file related meta-data |
<a name="TelegramBot+sendDice"></a>
### telegramBot.sendDice(chatId, [options]) ⇒ <code>Promise</code>
Send Dice Use this method to send a dice.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#senddice
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendDocument"></a> <a name="TelegramBot+sendDocument"></a>
### telegramBot.sendDocument(chatId, doc, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.sendDocument(chatId, doc, [options], [fileOptions]) ⇒ <code>Promise</code>
@ -555,11 +548,7 @@ Send voice
<a name="TelegramBot+sendChatAction"></a> <a name="TelegramBot+sendChatAction"></a>
### telegramBot.sendChatAction(chatId, action, [options]) ⇒ <code>Promise</code> ### telegramBot.sendChatAction(chatId, action, [options]) ⇒ <code>Promise</code>
Send chat action. Send chat action. `typing` for text messages, `upload_photo` for photos, `record_video` or `upload_video` for videos, `record_audio` or `upload_audio` for audio files, `upload_document` for general files, `find_location` for location data.
`typing` for text messages,
`upload_photo` for photos, `record_video` or `upload_video` for videos,
`record_audio` or `upload_audio` for audio files, `upload_document` for general files,
`find_location` for location data.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendchataction **See**: https://core.telegram.org/bots/api#sendchataction
@ -573,11 +562,7 @@ Send chat action.
<a name="TelegramBot+kickChatMember"></a> <a name="TelegramBot+kickChatMember"></a>
### telegramBot.kickChatMember(chatId, userId, [options]) ⇒ <code>Promise</code> ### telegramBot.kickChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
Use this method to kick a user from a group or a supergroup. Use this method to kick a user from a group or a supergroup. In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the group for this to work. Returns True on success.
In the case of supergroups, the user will not be able to return
to the group on their own using invite links, etc., unless unbanned
first. The bot must be an administrator in the group for this to work.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#kickchatmember **See**: https://core.telegram.org/bots/api#kickchatmember
@ -591,10 +576,7 @@ Returns True on success.
<a name="TelegramBot+unbanChatMember"></a> <a name="TelegramBot+unbanChatMember"></a>
### telegramBot.unbanChatMember(chatId, userId, [options]) ⇒ <code>Promise</code> ### telegramBot.unbanChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
Use this method to unban a previously kicked user in a supergroup. Use this method to unban a previously kicked user in a supergroup. The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work. Returns True on success.
The user will not return to the group automatically, but will be
able to join via link, etc. The bot must be an administrator in
the group for this to work. Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#unbanchatmember **See**: https://core.telegram.org/bots/api#unbanchatmember
@ -608,10 +590,7 @@ the group for this to work. Returns True on success.
<a name="TelegramBot+restrictChatMember"></a> <a name="TelegramBot+restrictChatMember"></a>
### telegramBot.restrictChatMember(chatId, userId, [options]) ⇒ <code>Promise</code> ### telegramBot.restrictChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
Use this method to restrict a user in a supergroup. Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success.
The bot must be an administrator in the supergroup for this to work
and must have the appropriate admin rights. Pass True for all boolean parameters
to lift restrictions from a user. Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#restrictchatmember **See**: https://core.telegram.org/bots/api#restrictchatmember
@ -625,10 +604,7 @@ to lift restrictions from a user. Returns True on success.
<a name="TelegramBot+promoteChatMember"></a> <a name="TelegramBot+promoteChatMember"></a>
### telegramBot.promoteChatMember(chatId, userId, [options]) ⇒ <code>Promise</code> ### telegramBot.promoteChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
Use this method to promote or demote a user in a supergroup or a channel. Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
The bot must be an administrator in the chat for this to work
and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#promotechatmember **See**: https://core.telegram.org/bots/api#promotechatmember
@ -642,41 +618,36 @@ Returns True on success.
<a name="TelegramBot+setChatAdministratorCustomTitle"></a> <a name="TelegramBot+setChatAdministratorCustomTitle"></a>
### telegramBot.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options]) ⇒ <code>Promise</code> ### telegramBot.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options]) ⇒ <code>Promise</code>
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setchatadministratorcustomtitle **See**: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Integer or String</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
| userId | <code>Integer</code> | Unique identifier of the target user | | userId | <code>Number</code> | Unique identifier of the target user |
| customTitle | <code>String</code> | New custom title for the administrator; 0-16 characters, emoji are not allowed | | customTitle | <code>String</code> | New custom title for the administrator; 0-16 characters, emoji are not allowed |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+setChatPermissions"></a> <a name="TelegramBot+setChatPermissions"></a>
### telegramBot.setChatPermissions(chatId, ChatPermissions, [options]) ⇒ <code>Promise</code> ### telegramBot.setChatPermissions(chatId, chatPermissions, [options]) ⇒ <code>Promise</code>
Use this method to set default chat permissions for all members. The bot must be an administrator Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success.
in the group or a supergroup for this to work and must have the can_restrict_members admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setchatpermissions **See**: https://core.telegram.org/bots/api#setchatpermissions
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| chatId | <code>Integer or String</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
| ChatPermissions | <code>Object</code> | New default chat permissions | | chatPermissions | <code>Array</code> | New default chat permissions |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+exportChatInviteLink"></a> <a name="TelegramBot+exportChatInviteLink"></a>
### telegramBot.exportChatInviteLink(chatId, [options]) ⇒ <code>Promise</code> ### telegramBot.exportChatInviteLink(chatId, [options]) ⇒ <code>Promise</code>
Use this method to export an invite link to a supergroup or a channel. Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns exported invite link as String on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#exportchatinvitelink **See**: https://core.telegram.org/bots/api#exportchatinvitelink
@ -686,12 +657,53 @@ Returns exported invite link as String on success.
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+createChatInviteLink"></a>
### telegramBot.createChatInviteLink(chatId, [options]) ⇒ <code>Object</code>
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as ChatInviteLink object.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Object</code> - ChatInviteLink
**See**: https://core.telegram.org/bots/api#createchatinvitelink
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+editChatInviteLink"></a>
### telegramBot.editChatInviteLink(chatId, inviteLink, [options]) ⇒ <code>Object</code>
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the edited invite link as a ChatInviteLink object.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Object</code> - ChatInviteLink
**See**: https://core.telegram.org/bots/api#editchatinvitelink
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
| inviteLink | <code>String</code> | Text with the invite link to edit |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+revokeChatInviteLink"></a>
### telegramBot.revokeChatInviteLink(chatId, [options]) ⇒ <code>Object</code>
Use this method to revoke an invite link created by the bot. Note: If the primary link is revoked, a new link is automatically generated The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the revoked invite link as ChatInviteLink object.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Object</code> - ChatInviteLink
**See**: https://core.telegram.org/bots/api#revokechatinvitelink
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+setChatPhoto"></a> <a name="TelegramBot+setChatPhoto"></a>
### telegramBot.setChatPhoto(chatId, photo, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.setChatPhoto(chatId, photo, [options], [fileOptions]) ⇒ <code>Promise</code>
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setchatphoto **See**: https://core.telegram.org/bots/api#setchatphoto
@ -706,9 +718,7 @@ Returns True on success.
<a name="TelegramBot+deleteChatPhoto"></a> <a name="TelegramBot+deleteChatPhoto"></a>
### telegramBot.deleteChatPhoto(chatId, [options]) ⇒ <code>Promise</code> ### telegramBot.deleteChatPhoto(chatId, [options]) ⇒ <code>Promise</code>
Use this method to delete a chat photo. Photos can't be changed for private chats. Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#deletechatphoto **See**: https://core.telegram.org/bots/api#deletechatphoto
@ -721,9 +731,7 @@ Returns True on success.
<a name="TelegramBot+setChatTitle"></a> <a name="TelegramBot+setChatTitle"></a>
### telegramBot.setChatTitle(chatId, title, [options]) ⇒ <code>Promise</code> ### telegramBot.setChatTitle(chatId, title, [options]) ⇒ <code>Promise</code>
Use this method to change the title of a chat. Titles can't be changed for private chats. Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setchattitle **See**: https://core.telegram.org/bots/api#setchattitle
@ -737,9 +745,7 @@ Returns True on success.
<a name="TelegramBot+setChatDescription"></a> <a name="TelegramBot+setChatDescription"></a>
### telegramBot.setChatDescription(chatId, description, [options]) ⇒ <code>Promise</code> ### telegramBot.setChatDescription(chatId, description, [options]) ⇒ <code>Promise</code>
Use this method to change the description of a supergroup or a channel. Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setchatdescription **See**: https://core.telegram.org/bots/api#setchatdescription
@ -753,9 +759,7 @@ Returns True on success.
<a name="TelegramBot+pinChatMessage"></a> <a name="TelegramBot+pinChatMessage"></a>
### telegramBot.pinChatMessage(chatId, messageId, [options]) ⇒ <code>Promise</code> ### telegramBot.pinChatMessage(chatId, messageId, [options]) ⇒ <code>Promise</code>
Use this method to pin a message in a supergroup. Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#pinchatmessage **See**: https://core.telegram.org/bots/api#pinchatmessage
@ -769,9 +773,7 @@ Returns True on success.
<a name="TelegramBot+unpinChatMessage"></a> <a name="TelegramBot+unpinChatMessage"></a>
### telegramBot.unpinChatMessage(chatId, [options]) ⇒ <code>Promise</code> ### telegramBot.unpinChatMessage(chatId, [options]) ⇒ <code>Promise</code>
Use this method to unpin a message from the list of pinned messages in a chat. Use this method to unpin a message in a supergroup chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#unpinchatmessage **See**: https://core.telegram.org/bots/api#unpinchatmessage
@ -784,9 +786,7 @@ Returns True on success.
<a name="TelegramBot+unpinAllChatMessages"></a> <a name="TelegramBot+unpinAllChatMessages"></a>
### telegramBot.unpinAllChatMessages(chatId, [options]) ⇒ <code>Promise</code> ### telegramBot.unpinAllChatMessages(chatId, [options]) ⇒ <code>Promise</code>
Use this method to clear the list of pinned messages in a chat Use this method to clear the list of pinned messages in a chat The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#unpinallchatmessages **See**: https://core.telegram.org/bots/api#unpinallchatmessages
@ -799,13 +799,7 @@ Returns True on success.
<a name="TelegramBot+answerCallbackQuery"></a> <a name="TelegramBot+answerCallbackQuery"></a>
### telegramBot.answerCallbackQuery(callbackQueryId, [options]) ⇒ <code>Promise</code> ### telegramBot.answerCallbackQuery(callbackQueryId, [options]) ⇒ <code>Promise</code>
Use this method to send answers to callback queries sent from Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. This method has **older, compatible signatures ([1][answerCallbackQuery-v0.27.1])([2][answerCallbackQuery-v0.29.0])** that are being deprecated.
inline keyboards. The answer will be displayed to the user as
a notification at the top of the chat screen or as an alert.
On success, True is returned.
This method has **older, compatible signatures ([1][answerCallbackQuery-v0.27.1])([2][answerCallbackQuery-v0.29.0])**
that are being deprecated.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#answercallbackquery **See**: https://core.telegram.org/bots/api#answercallbackquery
@ -815,11 +809,23 @@ that are being deprecated.
| callbackQueryId | <code>String</code> | Unique identifier for the query to be answered | | callbackQueryId | <code>String</code> | Unique identifier for the query to be answered |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+setMyCommands"></a>
### telegramBot.setMyCommands(commands, [options]) ⇒ <code>Promise</code>
Returns True on success. Use this method to change the list of the bot's commands.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setmycommands
| Param | Type | Description |
| --- | --- | --- |
| commands | <code>Array</code> | Poll options, between 2-10 options |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+getMyCommands"></a> <a name="TelegramBot+getMyCommands"></a>
### telegramBot.getMyCommands([options]) ⇒ <code>Promise</code> ### telegramBot.getMyCommands([options]) ⇒ <code>Promise</code>
Use this method to get the current list of the bot's commands Returns Array of BotCommand on success.
Returns True on success.Returns Array of BotCommand on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getmycommands **See**: https://core.telegram.org/bots/api#getmycommands
@ -828,29 +834,10 @@ Returns True on success.Returns Array of BotCommand on success.
| --- | --- | --- | | --- | --- | --- |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+setMyCommands"></a>
### telegramBot.setMyCommands(commands, [options]) ⇒ <code>Promise</code>
Use this method to change the list of the bot's commands.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setmycommands
| Param | Type | Description |
| --- | --- | --- |
| commands | <code>Array of BotCommand</code> | A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+editMessageText"></a> <a name="TelegramBot+editMessageText"></a>
### telegramBot.editMessageText(text, [options]) ⇒ <code>Promise</code> ### telegramBot.editMessageText(text, [options]) ⇒ <code>Promise</code>
Use this method to edit text messages sent by the bot or via Use this method to edit text messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
the bot (for inline bots). On success, the edited Message is
returned.
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#editmessagetext **See**: https://core.telegram.org/bots/api#editmessagetext
@ -863,12 +850,7 @@ inline_message_id in your request.
<a name="TelegramBot+editMessageCaption"></a> <a name="TelegramBot+editMessageCaption"></a>
### telegramBot.editMessageCaption(caption, [options]) ⇒ <code>Promise</code> ### telegramBot.editMessageCaption(caption, [options]) ⇒ <code>Promise</code>
Use this method to edit captions of messages sent by the Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
bot or via the bot (for inline bots). On success, the
edited Message is returned.
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#editmessagecaption **See**: https://core.telegram.org/bots/api#editmessagecaption
@ -881,14 +863,7 @@ inline_message_id in your request.
<a name="TelegramBot+editMessageMedia"></a> <a name="TelegramBot+editMessageMedia"></a>
### telegramBot.editMessageMedia(media, [options]) ⇒ <code>Promise</code> ### telegramBot.editMessageMedia(media, [options]) ⇒ <code>Promise</code>
Use this method to edit audio, document, photo, or video messages. Use this method to edit audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
If a message is a part of a message album, then it can be edited only to a photo or a video.
Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded.
Use previously uploaded file via its file_id or specify a URL.
On success, the edited Message is returned.
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#editmessagemedia **See**: https://core.telegram.org/bots/api#editmessagemedia
@ -901,12 +876,7 @@ inline_message_id in your request.
<a name="TelegramBot+editMessageReplyMarkup"></a> <a name="TelegramBot+editMessageReplyMarkup"></a>
### telegramBot.editMessageReplyMarkup(replyMarkup, [options]) ⇒ <code>Promise</code> ### telegramBot.editMessageReplyMarkup(replyMarkup, [options]) ⇒ <code>Promise</code>
Use this method to edit only the reply markup of messages Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
sent by the bot or via the bot (for inline bots).
On success, the edited Message is returned.
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#editmessagetext **See**: https://core.telegram.org/bots/api#editmessagetext
@ -919,10 +889,7 @@ inline_message_id in your request.
<a name="TelegramBot+getUserProfilePhotos"></a> <a name="TelegramBot+getUserProfilePhotos"></a>
### telegramBot.getUserProfilePhotos(userId, [options]) ⇒ <code>Promise</code> ### telegramBot.getUserProfilePhotos(userId, [options]) ⇒ <code>Promise</code>
Use this method to get a list of profile pictures for a user. Use this method to get a list of profile pictures for a user. Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object. This method has an [older, compatible signature][getUserProfilePhotos-v0.25.0] that is being deprecated.
Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object.
This method has an [older, compatible signature][getUserProfilePhotos-v0.25.0]
that is being deprecated.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getuserprofilephotos **See**: https://core.telegram.org/bots/api#getuserprofilephotos
@ -935,8 +902,7 @@ that is being deprecated.
<a name="TelegramBot+sendLocation"></a> <a name="TelegramBot+sendLocation"></a>
### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ <code>Promise</code> ### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ <code>Promise</code>
Send location. Send location. Use this method to send point on the map.
Use this method to send point on the map.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendlocation **See**: https://core.telegram.org/bots/api#sendlocation
@ -951,11 +917,7 @@ Use this method to send point on the map.
<a name="TelegramBot+editMessageLiveLocation"></a> <a name="TelegramBot+editMessageLiveLocation"></a>
### telegramBot.editMessageLiveLocation(latitude, longitude, [options]) ⇒ <code>Promise</code> ### telegramBot.editMessageLiveLocation(latitude, longitude, [options]) ⇒ <code>Promise</code>
Use this method to edit live location messages sent by Use this method to edit live location messages sent by the bot or via the bot (for inline bots). Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
the bot or via the bot (for inline bots).
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#editmessagelivelocation **See**: https://core.telegram.org/bots/api#editmessagelivelocation
@ -969,11 +931,7 @@ inline_message_id in your request.
<a name="TelegramBot+stopMessageLiveLocation"></a> <a name="TelegramBot+stopMessageLiveLocation"></a>
### telegramBot.stopMessageLiveLocation([options]) ⇒ <code>Promise</code> ### telegramBot.stopMessageLiveLocation([options]) ⇒ <code>Promise</code>
Use this method to stop updating a live location message sent by Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
the bot or via the bot (for inline bots) before live_period expires.
Note that you must provide one of chat_id, message_id, or
inline_message_id in your request.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#stopmessagelivelocation **See**: https://core.telegram.org/bots/api#stopmessagelivelocation
@ -985,8 +943,7 @@ inline_message_id in your request.
<a name="TelegramBot+sendVenue"></a> <a name="TelegramBot+sendVenue"></a>
### telegramBot.sendVenue(chatId, latitude, longitude, title, address, [options]) ⇒ <code>Promise</code> ### telegramBot.sendVenue(chatId, latitude, longitude, title, address, [options]) ⇒ <code>Promise</code>
Send venue. Send venue. Use this method to send information about a venue.
Use this method to send information about a venue.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendvenue **See**: https://core.telegram.org/bots/api#sendvenue
@ -1003,8 +960,7 @@ Use this method to send information about a venue.
<a name="TelegramBot+sendContact"></a> <a name="TelegramBot+sendContact"></a>
### telegramBot.sendContact(chatId, phoneNumber, firstName, [options]) ⇒ <code>Promise</code> ### telegramBot.sendContact(chatId, phoneNumber, firstName, [options]) ⇒ <code>Promise</code>
Send contact. Send contact. Use this method to send phone contacts.
Use this method to send phone contacts.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendcontact **See**: https://core.telegram.org/bots/api#sendcontact
@ -1019,8 +975,7 @@ Use this method to send phone contacts.
<a name="TelegramBot+sendPoll"></a> <a name="TelegramBot+sendPoll"></a>
### telegramBot.sendPoll(chatId, question, pollOptions, [options]) ⇒ <code>Promise</code> ### telegramBot.sendPoll(chatId, question, pollOptions, [options]) ⇒ <code>Promise</code>
Send poll. Send poll. Use this method to send a native poll.
Use this method to send a native poll.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendpoll **See**: https://core.telegram.org/bots/api#sendpoll
@ -1035,8 +990,7 @@ Use this method to send a native poll.
<a name="TelegramBot+stopPoll"></a> <a name="TelegramBot+stopPoll"></a>
### telegramBot.stopPoll(chatId, pollId, [options]) ⇒ <code>Promise</code> ### telegramBot.stopPoll(chatId, pollId, [options]) ⇒ <code>Promise</code>
Stop poll. Stop poll. Use this method to stop a native poll.
Use this method to stop a native poll.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#stoppoll **See**: https://core.telegram.org/bots/api#stoppoll
@ -1047,26 +1001,10 @@ Use this method to stop a native poll.
| pollId | <code>Number</code> | Identifier of the original message with the poll | | pollId | <code>Number</code> | Identifier of the original message with the poll |
| [options] | <code>Object</code> | Additional Telegram query options | | [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+sendDice"></a>
### telegramBot.sendDice(chatId, [options]) ⇒ <code>Promise</code>
Send Dice.
Use this method to send a dice.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#senddice
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the group/channel |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+getFile"></a> <a name="TelegramBot+getFile"></a>
### telegramBot.getFile(fileId, [options]) ⇒ <code>Promise</code> ### telegramBot.getFile(fileId, [options]) ⇒ <code>Promise</code>
Get file. Get file. Use this method to get basic info about a file and prepare it for downloading. Attention: link will be valid for 1 hour.
Use this method to get basic info about a file and prepare it for downloading.
Attention: link will be valid for 1 hour.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getfile **See**: https://core.telegram.org/bots/api#getfile
@ -1079,12 +1017,7 @@ Attention: link will be valid for 1 hour.
<a name="TelegramBot+getFileLink"></a> <a name="TelegramBot+getFileLink"></a>
### telegramBot.getFileLink(fileId, [options]) ⇒ <code>Promise</code> ### telegramBot.getFileLink(fileId, [options]) ⇒ <code>Promise</code>
Get link for file. Get link for file. Use this method to get link for file for subsequent use. Attention: link will be valid for 1 hour. This method is a sugar extension of the (getFile)[#getfilefileid] method, which returns just path to file on remote server (you will have to manually build full uri after that).
Use this method to get link for file for subsequent use.
Attention: link will be valid for 1 hour.
This method is a sugar extension of the (getFile)[#getfilefileid] method,
which returns just path to file on remote server (you will have to manually build full uri after that).
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - promise Promise which will have *fileURI* in resolve callback **Returns**: <code>Promise</code> - promise Promise which will have *fileURI* in resolve callback
@ -1098,15 +1031,7 @@ which returns just path to file on remote server (you will have to manually buil
<a name="TelegramBot+getFileStream"></a> <a name="TelegramBot+getFileStream"></a>
### telegramBot.getFileStream(fileId, [options]) ⇒ <code>stream.Readable</code> ### telegramBot.getFileStream(fileId, [options]) ⇒ <code>stream.Readable</code>
Return a readable stream for file. Return a readable stream for file. `fileStream.path` is the specified file ID i.e. `fileId`. `fileStream` emits event `info` passing a single argument i.e. `info` with the interface `{ uri }` where `uri` is the URI of the file on Telegram servers. This method is a sugar extension of the [getFileLink](#TelegramBot+getFileLink) method, which returns the full URI to the file on remote server.
`fileStream.path` is the specified file ID i.e. `fileId`.
`fileStream` emits event `info` passing a single argument i.e.
`info` with the interface `{ uri }` where `uri` is the URI of the
file on Telegram servers.
This method is a sugar extension of the [getFileLink](#TelegramBot+getFileLink) method,
which returns the full URI to the file on remote server.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>stream.Readable</code> - fileStream **Returns**: <code>stream.Readable</code> - fileStream
@ -1119,10 +1044,7 @@ which returns the full URI to the file on remote server.
<a name="TelegramBot+downloadFile"></a> <a name="TelegramBot+downloadFile"></a>
### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ <code>Promise</code> ### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ <code>Promise</code>
Downloads file in the specified folder. Downloads file in the specified folder. This method is a sugar extension of the [getFileStream](#TelegramBot+getFileStream) method, which returns a readable file stream.
This method is a sugar extension of the [getFileStream](#TelegramBot+getFileStream) method,
which returns a readable file stream.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - promise Promise, which will have *filePath* of downloaded file in resolve callback **Returns**: <code>Promise</code> - promise Promise, which will have *filePath* of downloaded file in resolve callback
@ -1151,14 +1073,18 @@ Register a RegExp to test against an incomming text message.
Remove a listener registered with `onText()`. Remove a listener registered with `onText()`.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Object</code> - deletedListener The removed reply listener if **Returns**: <code>Object</code> - deletedListener The removed reply listener if found. This object has `regexp` and `callback` properties. If not found, returns `null`.
found. This object has `regexp` and `callback`
properties. If not found, returns `null`.
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| regexp | <code>RegExp</code> | RegExp used previously in `onText()` | | regexp | <code>RegExp</code> | RegExp used previously in `onText()` |
<a name="TelegramBot+clearTextListeners"></a>
### telegramBot.clearTextListeners()
Remove all listeners registered with `onText()`.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot+onReplyToMessage"></a> <a name="TelegramBot+onReplyToMessage"></a>
### telegramBot.onReplyToMessage(chatId, messageId, callback) ⇒ <code>Number</code> ### telegramBot.onReplyToMessage(chatId, messageId, callback) ⇒ <code>Number</code>
@ -1179,34 +1105,22 @@ Register a reply to wait for a message response.
Removes a reply that has been prev. registered for a message response. Removes a reply that has been prev. registered for a message response.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Object</code> - deletedListener The removed reply listener if **Returns**: <code>Object</code> - deletedListener The removed reply listener if found. This object has `id`, `chatId`, `messageId` and `callback` properties. If not found, returns `null`.
found. This object has `id`, `chatId`, `messageId` and `callback`
properties. If not found, returns `null`.
| Param | Type | Description | | Param | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| replyListenerId | <code>Number</code> | The ID of the reply listener. | | replyListenerId | <code>Number</code> | The ID of the reply listener. |
<a name="TelegramBot+clearTextListeners"></a>
### telegramBot.clearTextListeners()
Remove all listeners registered with `onText()`.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot+clearReplyListeners"></a> <a name="TelegramBot+clearReplyListeners"></a>
### telegramBot.clearReplyListeners() ### telegramBot.clearReplyListeners()
Removes all replies that have been previously registered for a message response. Removes all replies that have been prev. registered for a message response.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot+getChat"></a> <a name="TelegramBot+getChat"></a>
### telegramBot.getChat(chatId, [options]) ⇒ <code>Promise</code> ### telegramBot.getChat(chatId, [options]) ⇒ <code>Promise</code>
Use this method to get up to date information about the chat Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
(current name of the user for one-on-one conversations, current
username of a user, group or channel, etc.).
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#getchat **See**: https://core.telegram.org/bots/api#getchat
@ -1354,8 +1268,7 @@ Use this method to delete a message.
<a name="TelegramBot+sendInvoice"></a> <a name="TelegramBot+sendInvoice"></a>
### telegramBot.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options]) ⇒ <code>Promise</code> ### telegramBot.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options]) ⇒ <code>Promise</code>
Send invoice. Send invoice. Use this method to send an invoice.
Use this method to send an invoice.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#sendinvoice **See**: https://core.telegram.org/bots/api#sendinvoice
@ -1375,8 +1288,7 @@ Use this method to send an invoice.
<a name="TelegramBot+answerShippingQuery"></a> <a name="TelegramBot+answerShippingQuery"></a>
### telegramBot.answerShippingQuery(shippingQueryId, ok, [options]) ⇒ <code>Promise</code> ### telegramBot.answerShippingQuery(shippingQueryId, ok, [options]) ⇒ <code>Promise</code>
Answer shipping query.. Answer shipping query.. Use this method to reply to shipping queries.
Use this method to reply to shipping queries.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#answershippingquery **See**: https://core.telegram.org/bots/api#answershippingquery
@ -1390,8 +1302,7 @@ Use this method to reply to shipping queries.
<a name="TelegramBot+answerPreCheckoutQuery"></a> <a name="TelegramBot+answerPreCheckoutQuery"></a>
### telegramBot.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options]) ⇒ <code>Promise</code> ### telegramBot.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options]) ⇒ <code>Promise</code>
Answer pre-checkout query. Answer pre-checkout query. Use this method to confirm shipping of a product.
Use this method to confirm shipping of a product.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#answerprecheckoutquery **See**: https://core.telegram.org/bots/api#answerprecheckoutquery
@ -1418,8 +1329,7 @@ Use this method to get a sticker set. On success, a [StickerSet](https://core.te
<a name="TelegramBot+uploadStickerFile"></a> <a name="TelegramBot+uploadStickerFile"></a>
### telegramBot.uploadStickerFile(userId, pngSticker, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.uploadStickerFile(userId, pngSticker, [options], [fileOptions]) ⇒ <code>Promise</code>
Use this method to upload a .png file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple Use this method to upload a .png file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded [File](https://core.telegram.org/bots/api#file) on success.
times). Returns the uploaded [File](https://core.telegram.org/bots/api#file) on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#uploadstickerfile **See**: https://core.telegram.org/bots/api#uploadstickerfile
@ -1434,9 +1344,7 @@ times). Returns the uploaded [File](https://core.telegram.org/bots/api#file) on
<a name="TelegramBot+createNewStickerSet"></a> <a name="TelegramBot+createNewStickerSet"></a>
### telegramBot.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code>
Use this method to create new sticker set owned by a user. Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
The bot will be able to edit the created sticker set.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#createnewstickerset **See**: https://core.telegram.org/bots/api#createnewstickerset
@ -1458,8 +1366,7 @@ Returns True on success.
<a name="TelegramBot+addStickerToSet"></a> <a name="TelegramBot+addStickerToSet"></a>
### telegramBot.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code> ### telegramBot.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code>
Use this method to add a new sticker to a set created by the bot. Use this method to add a new sticker to a set created by the bot. Returns True on success.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#addstickertoset **See**: https://core.telegram.org/bots/api#addstickertoset
@ -1480,8 +1387,7 @@ Returns True on success.
<a name="TelegramBot+setStickerPositionInSet"></a> <a name="TelegramBot+setStickerPositionInSet"></a>
### telegramBot.setStickerPositionInSet(sticker, position, [options]) ⇒ <code>Promise</code> ### telegramBot.setStickerPositionInSet(sticker, position, [options]) ⇒ <code>Promise</code>
Use this method to move a sticker in a set created by the bot to a specific position. Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#setstickerpositioninset **See**: https://core.telegram.org/bots/api#setstickerpositioninset
@ -1499,8 +1405,7 @@ Returns True on success.
<a name="TelegramBot+deleteStickerFromSet"></a> <a name="TelegramBot+deleteStickerFromSet"></a>
### telegramBot.deleteStickerFromSet(sticker, [options]) ⇒ <code>Promise</code> ### telegramBot.deleteStickerFromSet(sticker, [options]) ⇒ <code>Promise</code>
Use this method to delete a sticker from a set created by the bot. Use this method to delete a sticker from a set created by the bot. Returns True on success.
Returns True on success.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See**: https://core.telegram.org/bots/api#deletestickerfromset **See**: https://core.telegram.org/bots/api#deletestickerfromset
@ -1517,12 +1422,7 @@ Returns True on success.
<a name="TelegramBot+sendMediaGroup"></a> <a name="TelegramBot+sendMediaGroup"></a>
### telegramBot.sendMediaGroup(chatId, media, [options]) ⇒ <code>Promise</code> ### telegramBot.sendMediaGroup(chatId, media, [options]) ⇒ <code>Promise</code>
Use this method to send a group of photos or videos as an album. Use this method to send a group of photos or videos as an album. On success, an array of the sent [Messages](https://core.telegram.org/bots/api#message) is returned. If you wish to [specify file options](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files), add a `fileOptions` property to the target input in `media`.
On success, an array of the sent [Messages](https://core.telegram.org/bots/api#message)
is returned.
If you wish to [specify file options](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files),
add a `fileOptions` property to the target input in `media`.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**See** **See**
@ -1545,15 +1445,14 @@ The different errors the library uses.
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot) **Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot.messageTypes"></a> <a name="TelegramBot.messageTypes"></a>
### TelegramBot.messageTypes : <code>Array.&lt;String&gt;</code> ### TelegramBot.messageTypes : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code>
The types of message updates the library handles. The types of message updates the library handles.
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot) **Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
<a name="TelegramBot.Promise"></a> <a name="TelegramBot.Promise"></a>
### TelegramBot.Promise ### TelegramBot.Promise
Change Promise library used internally, for all existing and new Change Promise library used internally, for all existing and new instances.
instances.
**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot) **Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
@ -1563,8 +1462,7 @@ instances.
**Example** **Example**
```js ```js
const TelegramBot = require('node-telegram-bot-api'); const TelegramBot = require('node-telegram-bot-api'); TelegramBot.Promise = myPromise;
TelegramBot.Promise = myPromise;
``` ```
* * * * * *

View File

@ -1,6 +1,6 @@
{ {
"name": "node-telegram-bot-api", "name": "node-telegram-bot-api",
"version": "0.51.0", "version": "0.52.0",
"description": "Telegram Bot API", "description": "Telegram Bot API",
"main": "./index.js", "main": "./index.js",
"directories": { "directories": {

View File

@ -48,6 +48,12 @@ const _messageTypes = [
'video', 'video',
'video_note', 'video_note',
'voice', 'voice',
'voice_chat_started',
'voice_chat_ended',
'voice_chat_participants_invited',
'message_auto_delete_timer_changed',
'chat_invite_link',
'chat_member_updated'
]; ];
const _deprecatedMessageTypes = [ const _deprecatedMessageTypes = [
'new_chat_participant', 'left_chat_participant' 'new_chat_participant', 'left_chat_participant'
@ -615,6 +621,8 @@ class TelegramBot extends EventEmitter {
const preCheckoutQuery = update.pre_checkout_query; const preCheckoutQuery = update.pre_checkout_query;
const poll = update.poll; const poll = update.poll;
const pollAnswer = update.poll_answer; const pollAnswer = update.poll_answer;
const chatMember = update.chat_member;
const myChatMember = update.my_chat_member;
if (message) { if (message) {
debug('Process Update message %j', message); debug('Process Update message %j', message);
@ -698,6 +706,12 @@ class TelegramBot extends EventEmitter {
} else if (pollAnswer) { } else if (pollAnswer) {
debug('Process Update poll_answer %j', pollAnswer); debug('Process Update poll_answer %j', pollAnswer);
this.emit('poll_answer', pollAnswer); this.emit('poll_answer', pollAnswer);
} else if (chatMember) {
debug('Process Update chat_member %j', chatMember);
this.emit('chat_member', chatMember);
} else if (myChatMember) {
debug('Process Update my_chat_member %j', myChatMember);
this.emit('my_chat_member', myChatMember);
} }
} }
@ -1140,6 +1154,56 @@ class TelegramBot extends EventEmitter {
return this._request('exportChatInviteLink', { form }); return this._request('exportChatInviteLink', { form });
} }
/**
* Use this method to create an additional invite link for a chat.
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
* Returns the new invite link as ChatInviteLink object.
*
* @param {Number|String} chatId Unique identifier for the target chat or username of the target supergroup
* @param {Object} [options] Additional Telegram query options
* @return {Object} ChatInviteLink
* @see https://core.telegram.org/bots/api#createchatinvitelink
*/
createChatInviteLink(chatId, form = {}) {
form.chat_id = chatId;
return this._request('createChatInviteLink', { form });
}
/**
* Use this method to edit a non-primary invite link created by the bot.
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
* Returns the edited invite link as a ChatInviteLink object.
*
* @param {Number|String} chatId Unique identifier for the target chat or username of the target supergroup
* @param {String} inviteLink Text with the invite link to edit
* @param {Object} [options] Additional Telegram query options
* @return {Object} ChatInviteLink
* @see https://core.telegram.org/bots/api#editchatinvitelink
*/
editChatInviteLink(chatId, inviteLink, form = {}) {
form.chat_id = chatId;
form.invite_link = inviteLink;
return this._request('editChatInviteLink', { form });
}
/**
* Use this method to revoke an invite link created by the bot.
* Note: If the primary link is revoked, a new link is automatically generated
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
* Returns the revoked invite link as ChatInviteLink object.
*
* @param {Number|String} chatId Unique identifier for the target chat or username of the target supergroup
* @param {Object} [options] Additional Telegram query options
* @return {Object} ChatInviteLink
* @see https://core.telegram.org/bots/api#revokechatinvitelink
*/
revokeChatInviteLink(chatId, inviteLink, form = {}) {
form.chat_id = chatId;
form.invite_link = inviteLink;
return this._request('revokeChatInviteLink', { form });
}
/** /**
* Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. * Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. * The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

View File

@ -901,6 +901,33 @@ describe('TelegramBot', function telegramSuite() {
}); });
}); });
describe('#createChatInviteLink', function createChatInviteLinkSuite() {
let inviteLink;
before(function before() {
utils.handleRatelimit(bot, 'createChatInviteLink', this);
utils.handleRatelimit(bot, 'editChatInviteLink', this);
utils.handleRatelimit(bot, 'revokeChatInviteLink', this);
});
it('should create a chat invite link', function test() {
return bot.createChatInviteLink(GROUPID).then(resp => {
assert(resp.invite_link.match(/^https:\/\/t\.me\/joinchat\/.+$/i), 'is a telegram invite link');
inviteLink = resp.invite_link;
});
});
it('should edit chat invite link', function test() {
return bot.editChatInviteLink(GROUPID, inviteLink, { member_limit: 3 }).then(resp => {
assert.strictEqual(resp.member_limit, 3);
});
});
it('should revoke chat invite link', function test() {
return bot.revokeChatInviteLink(GROUPID, inviteLink).then(resp => {
assert.strictEqual(resp.is_revoked, true);
});
});
});
describe('#setChatPhoto', function setChatPhotoSuite() { describe('#setChatPhoto', function setChatPhotoSuite() {
this.timeout(timeout); this.timeout(timeout);
before(function before() { before(function before() {