UNPKG

87 kBMarkdownView Raw
1# API Reference
2
3**Note:** If you are looking for available [events](usage.md#events) or usage of api, please refer [`usage.md`](usage.md).
4
5<a name="TelegramBot"></a>
6
7## TelegramBot
8TelegramBot
9
10**Kind**: global class
11**See**: https://core.telegram.org/bots/api
12
13* [TelegramBot](#TelegramBot)
14 * [new TelegramBot(token, [options])](#new_TelegramBot_new)
15 * _instance_
16 * [.on(event, listener)](#TelegramBot+on)
17 * [.startPolling([options])](#TelegramBot+startPolling) ⇒ <code>Promise</code>
18 * ~~[.initPolling([options])](#TelegramBot+initPolling) ⇒ <code>Promise</code>~~
19 * [.stopPolling([options])](#TelegramBot+stopPolling) ⇒ <code>Promise</code>
20 * [.isPolling()](#TelegramBot+isPolling) ⇒ <code>Boolean</code>
21 * [.openWebHook()](#TelegramBot+openWebHook) ⇒ <code>Promise</code>
22 * [.closeWebHook()](#TelegramBot+closeWebHook) ⇒ <code>Promise</code>
23 * [.hasOpenWebHook()](#TelegramBot+hasOpenWebHook) ⇒ <code>Boolean</code>
24 * [.getMe([options])](#TelegramBot+getMe) ⇒ <code>Promise</code>
25 * [.logOut([options])](#TelegramBot+logOut) ⇒ <code>Promise</code>
26 * [.close([options])](#TelegramBot+close) ⇒ <code>Promise</code>
27 * [.setWebHook(url, [options], [fileOptions])](#TelegramBot+setWebHook) ⇒ <code>Promise</code>
28 * [.deleteWebHook([options])](#TelegramBot+deleteWebHook) ⇒ <code>Promise</code>
29 * [.getWebHookInfo([options])](#TelegramBot+getWebHookInfo) ⇒ <code>Promise</code>
30 * [.getUpdates([options])](#TelegramBot+getUpdates) ⇒ <code>Promise</code>
31 * [.processUpdate(update)](#TelegramBot+processUpdate)
32 * [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code>
33 * [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ <code>Promise</code>
34 * [.forwardMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
35 * [.copyMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+copyMessage) ⇒ <code>Promise</code>
36 * [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
37 * [.sendAudio(chatId, audio, [options], [fileOptions])](#TelegramBot+sendAudio) ⇒ <code>Promise</code>
38 * [.sendDice(chatId, [options])](#TelegramBot+sendDice) ⇒ <code>Promise</code>
39 * [.sendDocument(chatId, doc, [options], [fileOptions])](#TelegramBot+sendDocument) ⇒ <code>Promise</code>
40 * [.sendSticker(chatId, sticker, [options], [fileOptions])](#TelegramBot+sendSticker) ⇒ <code>Promise</code>
41 * [.sendVideo(chatId, video, [options], [fileOptions])](#TelegramBot+sendVideo) ⇒ <code>Promise</code>
42 * [.sendAnimation(chatId, animation, [options], [fileOptions])](#TelegramBot+sendAnimation) ⇒ <code>Promise</code>
43 * [.sendVideoNote(chatId, videoNote, [options], [fileOptions])](#TelegramBot+sendVideoNote) ⇒ <code>Promise</code>
44 * [.sendVoice(chatId, voice, [options], [fileOptions])](#TelegramBot+sendVoice) ⇒ <code>Promise</code>
45 * [.sendChatAction(chatId, action, [options])](#TelegramBot+sendChatAction) ⇒ <code>Promise</code>
46 * ~~[.kickChatMember(chatId, userId, [options])](#TelegramBot+kickChatMember) ⇒ <code>Promise</code>~~
47 * [.banChatMember(chatId, userId, [options])](#TelegramBot+banChatMember) ⇒ <code>Promise</code>
48 * [.unbanChatMember(chatId, userId, [options])](#TelegramBot+unbanChatMember) ⇒ <code>Promise</code>
49 * [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ <code>Promise</code>
50 * [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ <code>Promise</code>
51 * [.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options])](#TelegramBot+setChatAdministratorCustomTitle) ⇒ <code>Promise</code>
52 * [.banChatSenderChat(chatId, senderChatId, [options])](#TelegramBot+banChatSenderChat) ⇒ <code>Boolean</code>
53 * [.unbanChatSenderChat(chatId, senderChatId, [options])](#TelegramBot+unbanChatSenderChat) ⇒ <code>Boolean</code>
54 * [.setChatPermissions(chatId, chatPermissions, [options])](#TelegramBot+setChatPermissions) ⇒ <code>Promise</code>
55 * [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ <code>Promise</code>
56 * [.createChatInviteLink(chatId, [options])](#TelegramBot+createChatInviteLink) ⇒ <code>Object</code>
57 * [.editChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+editChatInviteLink) ⇒ <code>Object</code>
58 * [.revokeChatInviteLink(chatId, [options])](#TelegramBot+revokeChatInviteLink) ⇒ <code>Object</code>
59 * [.approveChatJoinRequest(chatId, userId, [options])](#TelegramBot+approveChatJoinRequest) ⇒ <code>Boolean</code>
60 * [.declineChatJoinRequest(chatId, userId, [options])](#TelegramBot+declineChatJoinRequest) ⇒ <code>Boolean</code>
61 * [.setChatPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+setChatPhoto) ⇒ <code>Promise</code>
62 * [.deleteChatPhoto(chatId, [options])](#TelegramBot+deleteChatPhoto) ⇒ <code>Promise</code>
63 * [.setChatTitle(chatId, title, [options])](#TelegramBot+setChatTitle) ⇒ <code>Promise</code>
64 * [.setChatDescription(chatId, description, [options])](#TelegramBot+setChatDescription) ⇒ <code>Promise</code>
65 * [.pinChatMessage(chatId, messageId, [options])](#TelegramBot+pinChatMessage) ⇒ <code>Promise</code>
66 * [.unpinChatMessage(chatId, [options])](#TelegramBot+unpinChatMessage) ⇒ <code>Promise</code>
67 * [.unpinAllChatMessages(chatId, [options])](#TelegramBot+unpinAllChatMessages) ⇒ <code>Promise</code>
68 * [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ <code>Promise</code>
69 * [.setMyCommands(commands, [options])](#TelegramBot+setMyCommands) ⇒ <code>Promise</code>
70 * [.getMyCommands([options])](#TelegramBot+getMyCommands) ⇒ <code>Promise</code>
71 * [.deleteMyCommands([options])](#TelegramBot+deleteMyCommands) ⇒ <code>Promise</code>
72 * [.editMessageText(text, [options])](#TelegramBot+editMessageText) ⇒ <code>Promise</code>
73 * [.editMessageCaption(caption, [options])](#TelegramBot+editMessageCaption) ⇒ <code>Promise</code>
74 * [.editMessageMedia(media, [options])](#TelegramBot+editMessageMedia) ⇒ <code>Promise</code>
75 * [.editMessageReplyMarkup(replyMarkup, [options])](#TelegramBot+editMessageReplyMarkup) ⇒ <code>Promise</code>
76 * [.getUserProfilePhotos(userId, [options])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code>
77 * [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ <code>Promise</code>
78 * [.editMessageLiveLocation(latitude, longitude, [options])](#TelegramBot+editMessageLiveLocation) ⇒ <code>Promise</code>
79 * [.stopMessageLiveLocation([options])](#TelegramBot+stopMessageLiveLocation) ⇒ <code>Promise</code>
80 * [.sendVenue(chatId, latitude, longitude, title, address, [options])](#TelegramBot+sendVenue) ⇒ <code>Promise</code>
81 * [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code>
82 * [.sendPoll(chatId, question, pollOptions, [options])](#TelegramBot+sendPoll) ⇒ <code>Promise</code>
83 * [.stopPoll(chatId, pollId, [options])](#TelegramBot+stopPoll) ⇒ <code>Promise</code>
84 * [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ <code>Promise</code>
85 * [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ <code>Promise</code>
86 * [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ <code>stream.Readable</code>
87 * [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ <code>Promise</code>
88 * [.onText(regexp, callback)](#TelegramBot+onText)
89 * [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ <code>Object</code>
90 * [.clearTextListeners()](#TelegramBot+clearTextListeners)
91 * [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) ⇒ <code>Number</code>
92 * [.removeReplyListener(replyListenerId)](#TelegramBot+removeReplyListener) ⇒ <code>Object</code>
93 * [.clearReplyListeners()](#TelegramBot+clearReplyListeners)
94 * [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ <code>Promise</code>
95 * [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code>
96 * ~~[.getChatMembersCount(chatId, [options])](#TelegramBot+getChatMembersCount) ⇒ <code>Promise</code>~~
97 * [.getChatMemberCount(chatId, [options])](#TelegramBot+getChatMemberCount) ⇒ <code>Promise</code>
98 * [.getChatMember(chatId, userId, [options])](#TelegramBot+getChatMember) ⇒ <code>Promise</code>
99 * [.leaveChat(chatId, [options])](#TelegramBot+leaveChat) ⇒ <code>Promise</code>
100 * [.setChatStickerSet(chatId, stickerSetName, [options])](#TelegramBot+setChatStickerSet) ⇒ <code>Promise</code>
101 * [.deleteChatStickerSet(chatId, [options])](#TelegramBot+deleteChatStickerSet) ⇒ <code>Promise</code>
102 * [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ <code>Promise</code>
103 * [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ <code>Promise</code>
104 * [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ <code>Promise</code>
105 * [.deleteMessage(chatId, messageId, [options])](#TelegramBot+deleteMessage) ⇒ <code>Promise</code>
106 * [.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options])](#TelegramBot+sendInvoice) ⇒ <code>Promise</code>
107 * [.answerShippingQuery(shippingQueryId, ok, [options])](#TelegramBot+answerShippingQuery) ⇒ <code>Promise</code>
108 * [.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options])](#TelegramBot+answerPreCheckoutQuery) ⇒ <code>Promise</code>
109 * [.getStickerSet(name, [options])](#TelegramBot+getStickerSet) ⇒ <code>Promise</code>
110 * [.uploadStickerFile(userId, pngSticker, [options], [fileOptions])](#TelegramBot+uploadStickerFile) ⇒ <code>Promise</code>
111 * [.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions])](#TelegramBot+createNewStickerSet) ⇒ <code>Promise</code>
112 * [.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions])](#TelegramBot+addStickerToSet) ⇒ <code>Promise</code>
113 * [.setStickerPositionInSet(sticker, position, [options])](#TelegramBot+setStickerPositionInSet) ⇒ <code>Promise</code>
114 * [.deleteStickerFromSet(sticker, [options])](#TelegramBot+deleteStickerFromSet) ⇒ <code>Promise</code>
115 * [.sendMediaGroup(chatId, media, [options])](#TelegramBot+sendMediaGroup) ⇒ <code>Promise</code>
116 * _static_
117 * [.errors](#TelegramBot.errors) : <code>Object</code>
118 * [.messageTypes](#TelegramBot.messageTypes) : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code>
119 * [.Promise](#TelegramBot.Promise)
120
121<a name="new_TelegramBot_new"></a>
122
123### new TelegramBot(token, [options])
124Both request method to obtain messages are implemented. To use standard polling, set `polling: true`
125on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
126Emits `message` when a message arrives.
127
128
129| Param | Type | Default | Description |
130| --- | --- | --- | --- |
131| token | <code>String</code> | | Bot Token |
132| [options] | <code>Object</code> | | |
133| [options.polling] | <code>Boolean</code> \| <code>Object</code> | <code>false</code> | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. |
134| [options.polling.timeout] | <code>String</code> \| <code>Number</code> | <code>10</code> | *Deprecated. Use `options.polling.params` instead*. Timeout in seconds for long polling. |
135| [options.polling.interval] | <code>String</code> \| <code>Number</code> | <code>300</code> | Interval between requests in miliseconds |
136| [options.polling.autoStart] | <code>Boolean</code> | <code>true</code> | Start polling immediately |
137| [options.polling.params] | <code>Object</code> | | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. |
138| [options.polling.params.timeout] | <code>Number</code> | <code>10</code> | Timeout in seconds for long polling. |
139| [options.webHook] | <code>Boolean</code> \| <code>Object</code> | <code>false</code> | Set true to enable WebHook or set options |
140| [options.webHook.host] | <code>String</code> | <code>&quot;0.0.0.0&quot;</code> | Host to bind to |
141| [options.webHook.port] | <code>Number</code> | <code>8443</code> | Port to bind to |
142| [options.webHook.key] | <code>String</code> | | Path to file with PEM private key for webHook server. The file is read **synchronously**! |
143| [options.webHook.cert] | <code>String</code> | | Path to file with PEM certificate (public) for webHook server. The file is read **synchronously**! |
144| [options.webHook.pfx] | <code>String</code> | | Path to file with PFX private key and certificate chain for webHook server. The file is read **synchronously**! |
145| [options.webHook.autoOpen] | <code>Boolean</code> | <code>true</code> | Open webHook immediately |
146| [options.webHook.https] | <code>Object</code> | | Options to be passed to `https.createServer()`. Note that `options.webHook.key`, `options.webHook.cert` and `options.webHook.pfx`, if provided, will be used to override `key`, `cert` and `pfx` in this object, respectively. See https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener for more information. |
147| [options.webHook.healthEndpoint] | <code>String</code> | <code>&quot;/healthz&quot;</code> | An endpoint for health checks that always responds with 200 OK |
148| [options.onlyFirstMatch] | <code>Boolean</code> | <code>false</code> | Set to true to stop after first match. Otherwise, all regexps are executed |
149| [options.request] | <code>Object</code> | | Options which will be added for all requests to telegram api. See https://github.com/request/request#requestoptions-callback for more information. |
150| [options.baseApiUrl] | <code>String</code> | <code>&quot;https://api.telegram.org&quot;</code> | API Base URl; useful for proxying and testing |
151| [options.filepath] | <code>Boolean</code> | <code>true</code> | Allow passing file-paths as arguments when sending files, such as photos using `TelegramBot#sendPhoto()`. See [usage information][usage-sending-files-performance] for more information on this option and its consequences. |
152| [options.badRejection] | <code>Boolean</code> | <code>false</code> | Set to `true` **if and only if** the Node.js version you're using terminates the process on unhandled rejections. This option is only for *forward-compatibility purposes*. |
153
154<a name="TelegramBot+on"></a>
155
156### telegramBot.on(event, listener)
157Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events).
158This is the usual `emitter.on()` method.
159
160**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
161**See**
162
163- [Available events](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events)
164- https://nodejs.org/api/events.html#events_emitter_on_eventname_listener
165
166
167| Param | Type |
168| --- | --- |
169| event | <code>String</code> |
170| listener | <code>function</code> |
171
172<a name="TelegramBot+startPolling"></a>
173
174### telegramBot.startPolling([options]) ⇒ <code>Promise</code>
175Start polling.
176Rejects returned promise if a WebHook is being used by this instance.
177
178**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
179
180| Param | Type | Default | Description |
181| --- | --- | --- | --- |
182| [options] | <code>Object</code> | | |
183| [options.restart] | <code>Boolean</code> | <code>true</code> | Consecutive calls to this method causes polling to be restarted |
184
185<a name="TelegramBot+initPolling"></a>
186
187### ~~telegramBot.initPolling([options]) ⇒ <code>Promise</code>~~
188***Deprecated***
189
190Alias of `TelegramBot#startPolling()`. This is **deprecated**.
191
192**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
193
194| Param | Type |
195| --- | --- |
196| [options] | <code>Object</code> |
197
198<a name="TelegramBot+stopPolling"></a>
199
200### telegramBot.stopPolling([options]) ⇒ <code>Promise</code>
201Stops polling after the last polling request resolves.
202Multiple invocations do nothing if polling is already stopped.
203Returning the promise of the last polling request is **deprecated**.
204
205**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
206
207| Param | Type | Description |
208| --- | --- | --- |
209| [options] | <code>Object</code> | Options |
210| [options.cancel] | <code>Boolean</code> | Cancel current request |
211| [options.reason] | <code>String</code> | Reason for stopping polling |
212
213<a name="TelegramBot+isPolling"></a>
214
215### telegramBot.isPolling() ⇒ <code>Boolean</code>
216Return true if polling. Otherwise, false.
217
218**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
219<a name="TelegramBot+openWebHook"></a>
220
221### telegramBot.openWebHook() ⇒ <code>Promise</code>
222Open webhook.
223Multiple invocations do nothing if webhook is already open.
224Rejects returned promise if Polling is being used by this instance.
225
226**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
227<a name="TelegramBot+closeWebHook"></a>
228
229### telegramBot.closeWebHook() ⇒ <code>Promise</code>
230Close webhook after closing all current connections.
231Multiple invocations do nothing if webhook is already closed.
232
233**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
234**Returns**: <code>Promise</code> - promise
235<a name="TelegramBot+hasOpenWebHook"></a>
236
237### telegramBot.hasOpenWebHook() ⇒ <code>Boolean</code>
238Return true if using webhook and it is open i.e. accepts connections.
239Otherwise, false.
240
241**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
242<a name="TelegramBot+getMe"></a>
243
244### telegramBot.getMe([options]) ⇒ <code>Promise</code>
245Returns basic information about the bot in form of a `User` object.
246
247**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
248**See**: https://core.telegram.org/bots/api#getme
249
250| Param | Type | Description |
251| --- | --- | --- |
252| [options] | <code>Object</code> | Additional Telegram query options |
253
254<a name="TelegramBot+logOut"></a>
255
256### telegramBot.logOut([options]) ⇒ <code>Promise</code>
257This method log out your bot from the cloud Bot API server before launching the bot locally.
258You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates.
259After a successful call, you will not be able to log in again using the same token for 10 minutes.
260Returns True on success.
261
262**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
263**See**: https://core.telegram.org/bots/api#logout
264
265| Param | Type | Description |
266| --- | --- | --- |
267| [options] | <code>Object</code> | Additional Telegram query options |
268
269<a name="TelegramBot+close"></a>
270
271### telegramBot.close([options]) ⇒ <code>Promise</code>
272This method close the bot instance before moving it from one local server to another.
273This method will return error 429 in the first 10 minutes after the bot is launched.
274Returns True on success.
275
276**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
277**See**: https://core.telegram.org/bots/api#close
278
279| Param | Type | Description |
280| --- | --- | --- |
281| [options] | <code>Object</code> | Additional Telegram query options |
282
283<a name="TelegramBot+setWebHook"></a>
284
285### telegramBot.setWebHook(url, [options], [fileOptions]) ⇒ <code>Promise</code>
286Specify an url to receive incoming updates via an outgoing webHook.
287This method has an [older, compatible signature][setWebHook-v0.25.0]
288that is being deprecated.
289
290**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
291**See**
292
293- https://core.telegram.org/bots/api#setwebhook
294- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
295
296
297| Param | Type | Description |
298| --- | --- | --- |
299| url | <code>String</code> | URL where Telegram will make HTTP Post. Leave empty to delete webHook. |
300| [options] | <code>Object</code> | Additional Telegram query options |
301| [options.certificate] | <code>String</code> \| <code>stream.Stream</code> | PEM certificate key (public). |
302| [fileOptions] | <code>Object</code> | Optional file related meta-data |
303
304<a name="TelegramBot+deleteWebHook"></a>
305
306### telegramBot.deleteWebHook([options]) ⇒ <code>Promise</code>
307Use this method to remove webhook integration if you decide to
308switch back to getUpdates. Returns True on success.
309
310**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
311**See**: https://core.telegram.org/bots/api#deletewebhook
312
313| Param | Type | Description |
314| --- | --- | --- |
315| [options] | <code>Object</code> | Additional Telegram query options |
316
317<a name="TelegramBot+getWebHookInfo"></a>
318
319### telegramBot.getWebHookInfo([options]) ⇒ <code>Promise</code>
320Use this method to get current webhook status.
321On success, returns a [WebhookInfo](https://core.telegram.org/bots/api#webhookinfo) object.
322If the bot is using getUpdates, will return an object with the
323url field empty.
324
325**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
326**See**: https://core.telegram.org/bots/api#getwebhookinfo
327
328| Param | Type | Description |
329| --- | --- | --- |
330| [options] | <code>Object</code> | Additional Telegram query options |
331
332<a name="TelegramBot+getUpdates"></a>
333
334### telegramBot.getUpdates([options]) ⇒ <code>Promise</code>
335Use this method to receive incoming updates using long polling.
336This method has an [older, compatible signature][getUpdates-v0.25.0]
337that is being deprecated.
338
339**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
340**See**: https://core.telegram.org/bots/api#getupdates
341
342| Param | Type | Description |
343| --- | --- | --- |
344| [options] | <code>Object</code> | Additional Telegram query options |
345
346<a name="TelegramBot+processUpdate"></a>
347
348### telegramBot.processUpdate(update)
349Process an update; emitting the proper events and executing regexp
350callbacks. This method is useful should you be using a different
351way to fetch updates, other than those provided by TelegramBot.
352
353**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
354**See**: https://core.telegram.org/bots/api#update
355
356| Param | Type |
357| --- | --- |
358| update | <code>Object</code> |
359
360<a name="TelegramBot+sendMessage"></a>
361
362### telegramBot.sendMessage(chatId, text, [options]) ⇒ <code>Promise</code>
363Send text message.
364
365**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
366**See**: https://core.telegram.org/bots/api#sendmessage
367
368| Param | Type | Description |
369| --- | --- | --- |
370| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
371| text | <code>String</code> | Text of the message to be sent |
372| [options] | <code>Object</code> | Additional Telegram query options |
373
374<a name="TelegramBot+answerInlineQuery"></a>
375
376### telegramBot.answerInlineQuery(inlineQueryId, results, [options]) ⇒ <code>Promise</code>
377Send answers to an inline query.
378
379**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
380**See**: https://core.telegram.org/bots/api#answerinlinequery
381
382| Param | Type | Description |
383| --- | --- | --- |
384| inlineQueryId | <code>String</code> | Unique identifier of the query |
385| results | <code>[ &#x27;Array&#x27; ].&lt;InlineQueryResult&gt;</code> | An array of results for the inline query |
386| [options] | <code>Object</code> | Additional Telegram query options |
387
388<a name="TelegramBot+forwardMessage"></a>
389
390### telegramBot.forwardMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code>
391Forward messages of any kind.
392
393**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
394**See**: https://core.telegram.org/bots/api#forwardmessage
395
396| Param | Type | Description |
397| --- | --- | --- |
398| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
399| fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent |
400| messageId | <code>Number</code> \| <code>String</code> | Unique message identifier |
401| [options] | <code>Object</code> | Additional Telegram query options |
402
403<a name="TelegramBot+copyMessage"></a>
404
405### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code>
406Copy messages of any kind.
407The method is analogous to the method forwardMessages, but the copied message doesn't
408have a link to the original message.
409Returns the MessageId of the sent message on success.
410
411**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
412**See**: https://core.telegram.org/bots/api#copymessage
413
414| Param | Type | Description |
415| --- | --- | --- |
416| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
417| fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent |
418| messageId | <code>Number</code> \| <code>String</code> | Unique message identifier |
419| [options] | <code>Object</code> | Additional Telegram query options |
420
421<a name="TelegramBot+sendPhoto"></a>
422
423### telegramBot.sendPhoto(chatId, photo, [options], [fileOptions]) ⇒ <code>Promise</code>
424Send photo
425
426**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
427**See**
428
429- https://core.telegram.org/bots/api#sendphoto
430- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
431
432
433| Param | Type | Description |
434| --- | --- | --- |
435| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
436| photo | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or a Stream. Can also be a `file_id` previously uploaded |
437| [options] | <code>Object</code> | Additional Telegram query options |
438| [fileOptions] | <code>Object</code> | Optional file related meta-data |
439
440<a name="TelegramBot+sendAudio"></a>
441
442### telegramBot.sendAudio(chatId, audio, [options], [fileOptions]) ⇒ <code>Promise</code>
443Send audio
444
445**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
446**See**
447
448- https://core.telegram.org/bots/api#sendaudio
449- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
450
451
452| Param | Type | Description |
453| --- | --- | --- |
454| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
455| audio | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
456| [options] | <code>Object</code> | Additional Telegram query options |
457| [fileOptions] | <code>Object</code> | Optional file related meta-data |
458
459<a name="TelegramBot+sendDice"></a>
460
461### telegramBot.sendDice(chatId, [options]) ⇒ <code>Promise</code>
462Send Dice
463Use this method to send a dice.
464
465**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
466**See**: https://core.telegram.org/bots/api#senddice
467
468| Param | Type | Description |
469| --- | --- | --- |
470| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
471| [options] | <code>Object</code> | Additional Telegram query options |
472
473<a name="TelegramBot+sendDocument"></a>
474
475### telegramBot.sendDocument(chatId, doc, [options], [fileOptions]) ⇒ <code>Promise</code>
476Send Document
477
478**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
479**See**
480
481- https://core.telegram.org/bots/api#sendDocument
482- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
483
484
485| Param | Type | Description |
486| --- | --- | --- |
487| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
488| doc | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
489| [options] | <code>Object</code> | Additional Telegram query options |
490| [fileOptions] | <code>Object</code> | Optional file related meta-data |
491
492<a name="TelegramBot+sendSticker"></a>
493
494### telegramBot.sendSticker(chatId, sticker, [options], [fileOptions]) ⇒ <code>Promise</code>
495Send .webp stickers.
496
497**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
498**See**: https://core.telegram.org/bots/api#sendsticker
499
500| Param | Type | Description |
501| --- | --- | --- |
502| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
503| sticker | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. Stickers are WebP format files. |
504| [options] | <code>Object</code> | Additional Telegram query options |
505| [fileOptions] | <code>Object</code> | Optional file related meta-data |
506
507<a name="TelegramBot+sendVideo"></a>
508
509### telegramBot.sendVideo(chatId, video, [options], [fileOptions]) ⇒ <code>Promise</code>
510Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
511
512**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
513**See**
514
515- https://core.telegram.org/bots/api#sendvideo
516- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
517
518
519| Param | Type | Description |
520| --- | --- | --- |
521| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
522| video | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or Stream. Can also be a `file_id` previously uploaded. |
523| [options] | <code>Object</code> | Additional Telegram query options |
524| [fileOptions] | <code>Object</code> | Optional file related meta-data |
525
526<a name="TelegramBot+sendAnimation"></a>
527
528### telegramBot.sendAnimation(chatId, animation, [options], [fileOptions]) ⇒ <code>Promise</code>
529Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
530
531**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
532**See**
533
534- https://core.telegram.org/bots/api#sendanimation
535- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
536
537
538| Param | Type | Description |
539| --- | --- | --- |
540| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
541| animation | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
542| [options] | <code>Object</code> | Additional Telegram query options |
543| [fileOptions] | <code>Object</code> | Optional file related meta-data |
544
545<a name="TelegramBot+sendVideoNote"></a>
546
547### telegramBot.sendVideoNote(chatId, videoNote, [options], [fileOptions]) ⇒ <code>Promise</code>
548Use this method to send rounded square videos of upto 1 minute long.
549
550**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
551**Info**: The length parameter is actually optional. However, the API (at time of writing) requires you to always provide it until it is fixed.
552**See**
553
554- https://core.telegram.org/bots/api#sendvideonote
555- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
556
557
558| Param | Type | Description |
559| --- | --- | --- |
560| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
561| videoNote | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or Stream. Can also be a `file_id` previously uploaded. |
562| [options] | <code>Object</code> | Additional Telegram query options |
563| [fileOptions] | <code>Object</code> | Optional file related meta-data |
564
565<a name="TelegramBot+sendVoice"></a>
566
567### telegramBot.sendVoice(chatId, voice, [options], [fileOptions]) ⇒ <code>Promise</code>
568Send voice
569
570**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
571**See**
572
573- https://core.telegram.org/bots/api#sendvoice
574- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
575
576
577| Param | Type | Description |
578| --- | --- | --- |
579| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
580| voice | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. |
581| [options] | <code>Object</code> | Additional Telegram query options |
582| [fileOptions] | <code>Object</code> | Optional file related meta-data |
583
584<a name="TelegramBot+sendChatAction"></a>
585
586### telegramBot.sendChatAction(chatId, action, [options]) ⇒ <code>Promise</code>
587Send chat action.
588`typing` for text messages,
589`upload_photo` for photos, `record_video` or `upload_video` for videos,
590`record_voice` or `upload_voice` for audio files, `upload_document` for general files,
591`choose_sticker` for stickers, `find_location` for location data,
592`record_video_note` or `upload_video_note` for video notes.
593
594**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
595**See**: https://core.telegram.org/bots/api#sendchataction
596
597| Param | Type | Description |
598| --- | --- | --- |
599| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
600| action | <code>String</code> | Type of action to broadcast. |
601| [options] | <code>Object</code> | Additional Telegram query options |
602
603<a name="TelegramBot+kickChatMember"></a>
604
605### ~~telegramBot.kickChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>~~
606***Deprecated***
607
608Use this method to kick a user from a group or a supergroup.
609In the case of supergroups, the user will not be able to return
610to the group on their own using invite links, etc., unless unbanned
611first. The bot must be an administrator in the group for this to work.
612Returns True on success.
613
614**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
615**See**: https://core.telegram.org/bots/api#kickchatmember
616
617| Param | Type | Description |
618| --- | --- | --- |
619| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
620| userId | <code>Number</code> | Unique identifier of the target user |
621| [options] | <code>Object</code> | Additional Telegram query options |
622
623<a name="TelegramBot+banChatMember"></a>
624
625### telegramBot.banChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
626Use this method to ban a user in a group, a supergroup or a channel.
627In the case of supergroups and channels, the user will not be able to
628return to the chat on their own using invite links, etc., unless unbanned first..
629The bot must be an administrator in the group for this to work.
630Returns True on success.
631
632**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
633**See**: https://core.telegram.org/bots/api#banchatmember
634
635| Param | Type | Description |
636| --- | --- | --- |
637| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
638| userId | <code>Number</code> | Unique identifier of the target user |
639| [options] | <code>Object</code> | Additional Telegram query options |
640
641<a name="TelegramBot+unbanChatMember"></a>
642
643### telegramBot.unbanChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
644Use this method to unban a previously kicked user in a supergroup.
645The user will not return to the group automatically, but will be
646able to join via link, etc. The bot must be an administrator in
647the group for this to work. Returns True on success.
648
649**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
650**See**: https://core.telegram.org/bots/api#unbanchatmember
651
652| Param | Type | Description |
653| --- | --- | --- |
654| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
655| userId | <code>Number</code> | Unique identifier of the target user |
656| [options] | <code>Object</code> | Additional Telegram query options |
657
658<a name="TelegramBot+restrictChatMember"></a>
659
660### telegramBot.restrictChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
661Use this method to restrict a user in a supergroup.
662The bot must be an administrator in the supergroup for this to work
663and must have the appropriate admin rights. Pass True for all boolean parameters
664to lift restrictions from a user. Returns True on success.
665
666**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
667**See**: https://core.telegram.org/bots/api#restrictchatmember
668
669| Param | Type | Description |
670| --- | --- | --- |
671| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
672| userId | <code>Number</code> | Unique identifier of the target user |
673| [options] | <code>Object</code> | Additional Telegram query options |
674
675<a name="TelegramBot+promoteChatMember"></a>
676
677### telegramBot.promoteChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
678Use this method to promote or demote a user in a supergroup or a channel.
679The bot must be an administrator in the chat for this to work
680and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user.
681Returns True on success.
682
683**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
684**See**: https://core.telegram.org/bots/api#promotechatmember
685
686| Param | Type | Description |
687| --- | --- | --- |
688| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
689| userId | <code>Number</code> | |
690| [options] | <code>Object</code> | Additional Telegram query options |
691
692<a name="TelegramBot+setChatAdministratorCustomTitle"></a>
693
694### telegramBot.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options]) ⇒ <code>Promise</code>
695Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
696Returns True on success.
697
698**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
699**See**: https://core.telegram.org/bots/api#setchatadministratorcustomtitle
700
701| Param | Type | Description |
702| --- | --- | --- |
703| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
704| userId | <code>Number</code> | Unique identifier of the target user |
705| customTitle | <code>String</code> | New custom title for the administrator; 0-16 characters, emoji are not allowed |
706| [options] | <code>Object</code> | Additional Telegram query options |
707
708<a name="TelegramBot+banChatSenderChat"></a>
709
710### telegramBot.banChatSenderChat(chatId, senderChatId, [options]) ⇒ <code>Boolean</code>
711Use this method to ban a channel chat in a supergroup or a channel.
712The owner of the chat will not be able to send messages and join live streams
713on behalf of the chat, unless it is unbanned first.
714The bot must be an administrator in the supergroup or channel for this to work
715and must have the appropriate administrator rights.
716Returns True on success.
717
718**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
719**See**: https://core.telegram.org/bots/api#banchatsenderchat
720
721| Param | Type | Description |
722| --- | --- | --- |
723| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
724| senderChatId | <code>Number</code> | Unique identifier of the target user |
725| [options] | <code>Object</code> | Additional Telegram query options |
726
727<a name="TelegramBot+unbanChatSenderChat"></a>
728
729### telegramBot.unbanChatSenderChat(chatId, senderChatId, [options]) ⇒ <code>Boolean</code>
730Use this method to unban a previously banned channel chat in a supergroup or channel.
731The bot must be an administrator for this to work and must have the appropriate administrator rights.
732Returns True on success.
733
734**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
735**See**: https://core.telegram.org/bots/api#unbanchatsenderchat
736
737| Param | Type | Description |
738| --- | --- | --- |
739| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
740| senderChatId | <code>Number</code> | Unique identifier of the target user |
741| [options] | <code>Object</code> | Additional Telegram query options |
742
743<a name="TelegramBot+setChatPermissions"></a>
744
745### telegramBot.setChatPermissions(chatId, chatPermissions, [options]) ⇒ <code>Promise</code>
746Use this method to set default chat permissions for all members.
747The bot must be an administrator in the group or a supergroup for this to
748work and must have the can_restrict_members admin rights.
749Returns True on success.
750
751**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
752**See**: https://core.telegram.org/bots/api#setchatpermissions
753
754| Param | Type | Description |
755| --- | --- | --- |
756| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
757| chatPermissions | <code>Array</code> | New default chat permissions |
758| [options] | <code>Object</code> | Additional Telegram query options |
759
760<a name="TelegramBot+exportChatInviteLink"></a>
761
762### telegramBot.exportChatInviteLink(chatId, [options]) ⇒ <code>Promise</code>
763Use this method to export an invite link to a supergroup or a channel.
764The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
765Returns exported invite link as String on success.
766
767**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
768**See**: https://core.telegram.org/bots/api#exportchatinvitelink
769
770| Param | Type | Description |
771| --- | --- | --- |
772| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
773| [options] | <code>Object</code> | Additional Telegram query options |
774
775<a name="TelegramBot+createChatInviteLink"></a>
776
777### telegramBot.createChatInviteLink(chatId, [options]) ⇒ <code>Object</code>
778Use this method to create an additional invite link for a chat.
779The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
780Returns the new invite link as ChatInviteLink object.
781
782**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
783**Returns**: <code>Object</code> - ChatInviteLink
784**See**: https://core.telegram.org/bots/api#createchatinvitelink
785
786| Param | Type | Description |
787| --- | --- | --- |
788| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
789| [options] | <code>Object</code> | Additional Telegram query options |
790
791<a name="TelegramBot+editChatInviteLink"></a>
792
793### telegramBot.editChatInviteLink(chatId, inviteLink, [options]) ⇒ <code>Object</code>
794Use this method to edit a non-primary invite link created by the bot.
795The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
796Returns the edited invite link as a ChatInviteLink object.
797
798**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
799**Returns**: <code>Object</code> - ChatInviteLink
800**See**: https://core.telegram.org/bots/api#editchatinvitelink
801
802| Param | Type | Description |
803| --- | --- | --- |
804| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
805| inviteLink | <code>String</code> | Text with the invite link to edit |
806| [options] | <code>Object</code> | Additional Telegram query options |
807
808<a name="TelegramBot+revokeChatInviteLink"></a>
809
810### telegramBot.revokeChatInviteLink(chatId, [options]) ⇒ <code>Object</code>
811Use this method to revoke an invite link created by the bot.
812Note: If the primary link is revoked, a new link is automatically generated
813The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
814Returns the revoked invite link as ChatInviteLink object.
815
816**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
817**Returns**: <code>Object</code> - ChatInviteLink
818**See**: https://core.telegram.org/bots/api#revokechatinvitelink
819
820| Param | Type | Description |
821| --- | --- | --- |
822| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
823| [options] | <code>Object</code> | Additional Telegram query options |
824
825<a name="TelegramBot+approveChatJoinRequest"></a>
826
827### telegramBot.approveChatJoinRequest(chatId, userId, [options]) ⇒ <code>Boolean</code>
828Use this method to approve a chat join request.
829The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
830Returns True on success.
831
832**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
833**Returns**: <code>Boolean</code> - True on success
834**See**: https://core.telegram.org/bots/api#approvechatjoinrequest
835
836| Param | Type | Description |
837| --- | --- | --- |
838| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
839| userId | <code>Number</code> | Unique identifier of the target user |
840| [options] | <code>Object</code> | Additional Telegram query options |
841
842<a name="TelegramBot+declineChatJoinRequest"></a>
843
844### telegramBot.declineChatJoinRequest(chatId, userId, [options]) ⇒ <code>Boolean</code>
845Use this method to decline a chat join request.
846The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
847Returns True on success.
848
849**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
850**Returns**: <code>Boolean</code> - True on success
851**See**: https://core.telegram.org/bots/api#declinechatjoinrequest
852
853| Param | Type | Description |
854| --- | --- | --- |
855| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup |
856| userId | <code>Number</code> | Unique identifier of the target user |
857| [options] | <code>Object</code> | Additional Telegram query options |
858
859<a name="TelegramBot+setChatPhoto"></a>
860
861### telegramBot.setChatPhoto(chatId, photo, [options], [fileOptions]) ⇒ <code>Promise</code>
862Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
863The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
864Returns True on success.
865
866**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
867**See**: https://core.telegram.org/bots/api#setchatphoto
868
869| Param | Type | Description |
870| --- | --- | --- |
871| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
872| photo | <code>stream.Stream</code> \| <code>Buffer</code> | A file path or a Stream. |
873| [options] | <code>Object</code> | Additional Telegram query options |
874| [fileOptions] | <code>Object</code> | Optional file related meta-data |
875
876<a name="TelegramBot+deleteChatPhoto"></a>
877
878### telegramBot.deleteChatPhoto(chatId, [options]) ⇒ <code>Promise</code>
879Use this method to delete a chat photo. Photos can't be changed for private chats.
880The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
881Returns True on success.
882
883**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
884**See**: https://core.telegram.org/bots/api#deletechatphoto
885
886| Param | Type | Description |
887| --- | --- | --- |
888| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
889| [options] | <code>Object</code> | Additional Telegram query options |
890
891<a name="TelegramBot+setChatTitle"></a>
892
893### telegramBot.setChatTitle(chatId, title, [options]) ⇒ <code>Promise</code>
894Use this method to change the title of a chat. Titles can't be changed for private chats.
895The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
896Returns True on success.
897
898**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
899**See**: https://core.telegram.org/bots/api#setchattitle
900
901| Param | Type | Description |
902| --- | --- | --- |
903| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
904| title | <code>String</code> | New chat title, 1-255 characters |
905| [options] | <code>Object</code> | Additional Telegram query options |
906
907<a name="TelegramBot+setChatDescription"></a>
908
909### telegramBot.setChatDescription(chatId, description, [options]) ⇒ <code>Promise</code>
910Use this method to change the description of a supergroup or a channel.
911The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
912Returns True on success.
913
914**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
915**See**: https://core.telegram.org/bots/api#setchatdescription
916
917| Param | Type | Description |
918| --- | --- | --- |
919| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
920| description | <code>String</code> | New chat title, 1-255 characters |
921| [options] | <code>Object</code> | Additional Telegram query options |
922
923<a name="TelegramBot+pinChatMessage"></a>
924
925### telegramBot.pinChatMessage(chatId, messageId, [options]) ⇒ <code>Promise</code>
926Use this method to pin a message in a supergroup.
927The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
928Returns True on success.
929
930**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
931**See**: https://core.telegram.org/bots/api#pinchatmessage
932
933| Param | Type | Description |
934| --- | --- | --- |
935| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
936| messageId | <code>Number</code> | Identifier of a message to pin |
937| [options] | <code>Object</code> | Additional Telegram query options |
938
939<a name="TelegramBot+unpinChatMessage"></a>
940
941### telegramBot.unpinChatMessage(chatId, [options]) ⇒ <code>Promise</code>
942Use this method to unpin a message in a supergroup chat.
943The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
944Returns True on success.
945
946**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
947**See**: https://core.telegram.org/bots/api#unpinchatmessage
948
949| Param | Type | Description |
950| --- | --- | --- |
951| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
952| [options] | <code>Object</code> | Additional Telegram query options |
953
954<a name="TelegramBot+unpinAllChatMessages"></a>
955
956### telegramBot.unpinAllChatMessages(chatId, [options]) ⇒ <code>Promise</code>
957Use this method to clear the list of pinned messages in a chat
958The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
959Returns True on success.
960
961**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
962**See**: https://core.telegram.org/bots/api#unpinallchatmessages
963
964| Param | Type | Description |
965| --- | --- | --- |
966| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
967| [options] | <code>Object</code> | Additional Telegram query options |
968
969<a name="TelegramBot+answerCallbackQuery"></a>
970
971### telegramBot.answerCallbackQuery(callbackQueryId, [options]) ⇒ <code>Promise</code>
972Use this method to send answers to callback queries sent from
973inline keyboards. The answer will be displayed to the user as
974a notification at the top of the chat screen or as an alert.
975On success, True is returned.
976
977This method has **older, compatible signatures ([1][answerCallbackQuery-v0.27.1])([2][answerCallbackQuery-v0.29.0])**
978that are being deprecated.
979
980**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
981**See**: https://core.telegram.org/bots/api#answercallbackquery
982
983| Param | Type | Description |
984| --- | --- | --- |
985| callbackQueryId | <code>String</code> | Unique identifier for the query to be answered |
986| [options] | <code>Object</code> | Additional Telegram query options |
987
988<a name="TelegramBot+setMyCommands"></a>
989
990### telegramBot.setMyCommands(commands, [options]) ⇒ <code>Promise</code>
991Returns True on success.
992Use this method to change the list of the bot's commands.
993
994**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
995**See**: https://core.telegram.org/bots/api#setmycommands
996
997| Param | Type | Description |
998| --- | --- | --- |
999| commands | <code>Array</code> | Poll options, between 2-10 options |
1000| [options] | <code>Object</code> | Additional Telegram query options |
1001
1002<a name="TelegramBot+getMyCommands"></a>
1003
1004### telegramBot.getMyCommands([options]) ⇒ <code>Promise</code>
1005Returns Array of BotCommand on success.
1006
1007**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1008**See**: https://core.telegram.org/bots/api#getmycommands
1009
1010| Param | Type | Description |
1011| --- | --- | --- |
1012| [options] | <code>Object</code> | Additional Telegram query options |
1013
1014<a name="TelegramBot+deleteMyCommands"></a>
1015
1016### telegramBot.deleteMyCommands([options]) ⇒ <code>Promise</code>
1017Returns True on success.
1018Use this method to delete the list of the bot's commands for the given scope and user language.
1019
1020**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1021**See**: https://core.telegram.org/bots/api#deletemycommands
1022
1023| Param | Type | Description |
1024| --- | --- | --- |
1025| [options] | <code>Object</code> | Additional Telegram query options |
1026
1027<a name="TelegramBot+editMessageText"></a>
1028
1029### telegramBot.editMessageText(text, [options]) ⇒ <code>Promise</code>
1030Use this method to edit text messages sent by the bot or via
1031the bot (for inline bots). On success, the edited Message is
1032returned.
1033
1034Note that you must provide one of chat_id, message_id, or
1035inline_message_id in your request.
1036
1037**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1038**See**: https://core.telegram.org/bots/api#editmessagetext
1039
1040| Param | Type | Description |
1041| --- | --- | --- |
1042| text | <code>String</code> | New text of the message |
1043| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1044
1045<a name="TelegramBot+editMessageCaption"></a>
1046
1047### telegramBot.editMessageCaption(caption, [options]) ⇒ <code>Promise</code>
1048Use this method to edit captions of messages sent by the
1049bot or via the bot (for inline bots). On success, the
1050edited Message is returned.
1051
1052Note that you must provide one of chat_id, message_id, or
1053inline_message_id in your request.
1054
1055**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1056**See**: https://core.telegram.org/bots/api#editmessagecaption
1057
1058| Param | Type | Description |
1059| --- | --- | --- |
1060| caption | <code>String</code> | New caption of the message |
1061| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1062
1063<a name="TelegramBot+editMessageMedia"></a>
1064
1065### telegramBot.editMessageMedia(media, [options]) ⇒ <code>Promise</code>
1066Use this method to edit audio, document, photo, or video messages.
1067If a message is a part of a message album, then it can be edited only to a photo or a video.
1068Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded.
1069Use previously uploaded file via its file_id or specify a URL.
1070On success, the edited Message is returned.
1071
1072Note that you must provide one of chat_id, message_id, or inline_message_id in your request.
1073
1074**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1075**See**: https://core.telegram.org/bots/api#editmessagemedia
1076
1077| Param | Type | Description |
1078| --- | --- | --- |
1079| media | <code>Object</code> | A JSON-serialized object for a new media content of the message |
1080| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1081
1082<a name="TelegramBot+editMessageReplyMarkup"></a>
1083
1084### telegramBot.editMessageReplyMarkup(replyMarkup, [options]) ⇒ <code>Promise</code>
1085Use this method to edit only the reply markup of messages
1086sent by the bot or via the bot (for inline bots).
1087On success, the edited Message is returned.
1088
1089Note that you must provide one of chat_id, message_id, or
1090inline_message_id in your request.
1091
1092**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1093**See**: https://core.telegram.org/bots/api#editmessagetext
1094
1095| Param | Type | Description |
1096| --- | --- | --- |
1097| replyMarkup | <code>Object</code> | A JSON-serialized object for an inline keyboard. |
1098| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1099
1100<a name="TelegramBot+getUserProfilePhotos"></a>
1101
1102### telegramBot.getUserProfilePhotos(userId, [options]) ⇒ <code>Promise</code>
1103Use this method to get a list of profile pictures for a user.
1104Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object.
1105This method has an [older, compatible signature][getUserProfilePhotos-v0.25.0]
1106that is being deprecated.
1107
1108**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1109**See**: https://core.telegram.org/bots/api#getuserprofilephotos
1110
1111| Param | Type | Description |
1112| --- | --- | --- |
1113| userId | <code>Number</code> | Unique identifier of the target user |
1114| [options] | <code>Object</code> | Additional Telegram query options |
1115
1116<a name="TelegramBot+sendLocation"></a>
1117
1118### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ <code>Promise</code>
1119Send location.
1120Use this method to send point on the map.
1121
1122**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1123**See**: https://core.telegram.org/bots/api#sendlocation
1124
1125| Param | Type | Description |
1126| --- | --- | --- |
1127| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
1128| latitude | <code>Float</code> | Latitude of location |
1129| longitude | <code>Float</code> | Longitude of location |
1130| [options] | <code>Object</code> | Additional Telegram query options |
1131
1132<a name="TelegramBot+editMessageLiveLocation"></a>
1133
1134### telegramBot.editMessageLiveLocation(latitude, longitude, [options]) ⇒ <code>Promise</code>
1135Use this method to edit live location messages sent by
1136the bot or via the bot (for inline bots).
1137
1138Note that you must provide one of chat_id, message_id, or
1139inline_message_id in your request.
1140
1141**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1142**See**: https://core.telegram.org/bots/api#editmessagelivelocation
1143
1144| Param | Type | Description |
1145| --- | --- | --- |
1146| latitude | <code>Float</code> | Latitude of location |
1147| longitude | <code>Float</code> | Longitude of location |
1148| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1149
1150<a name="TelegramBot+stopMessageLiveLocation"></a>
1151
1152### telegramBot.stopMessageLiveLocation([options]) ⇒ <code>Promise</code>
1153Use this method to stop updating a live location message sent by
1154the bot or via the bot (for inline bots) before live_period expires.
1155
1156Note that you must provide one of chat_id, message_id, or
1157inline_message_id in your request.
1158
1159**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1160**See**: https://core.telegram.org/bots/api#stopmessagelivelocation
1161
1162| Param | Type | Description |
1163| --- | --- | --- |
1164| [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) |
1165
1166<a name="TelegramBot+sendVenue"></a>
1167
1168### telegramBot.sendVenue(chatId, latitude, longitude, title, address, [options]) ⇒ <code>Promise</code>
1169Send venue.
1170Use this method to send information about a venue.
1171
1172**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1173**See**: https://core.telegram.org/bots/api#sendvenue
1174
1175| Param | Type | Description |
1176| --- | --- | --- |
1177| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
1178| latitude | <code>Float</code> | Latitude of location |
1179| longitude | <code>Float</code> | Longitude of location |
1180| title | <code>String</code> | Name of the venue |
1181| address | <code>String</code> | Address of the venue |
1182| [options] | <code>Object</code> | Additional Telegram query options |
1183
1184<a name="TelegramBot+sendContact"></a>
1185
1186### telegramBot.sendContact(chatId, phoneNumber, firstName, [options]) ⇒ <code>Promise</code>
1187Send contact.
1188Use this method to send phone contacts.
1189
1190**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1191**See**: https://core.telegram.org/bots/api#sendcontact
1192
1193| Param | Type | Description |
1194| --- | --- | --- |
1195| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
1196| phoneNumber | <code>String</code> | Contact's phone number |
1197| firstName | <code>String</code> | Contact's first name |
1198| [options] | <code>Object</code> | Additional Telegram query options |
1199
1200<a name="TelegramBot+sendPoll"></a>
1201
1202### telegramBot.sendPoll(chatId, question, pollOptions, [options]) ⇒ <code>Promise</code>
1203Send poll.
1204Use this method to send a native poll.
1205
1206**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1207**See**: https://core.telegram.org/bots/api#sendpoll
1208
1209| Param | Type | Description |
1210| --- | --- | --- |
1211| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the group/channel |
1212| question | <code>String</code> | Poll question, 255 char limit |
1213| pollOptions | <code>Array</code> | Poll options, between 2-10 options |
1214| [options] | <code>Object</code> | Additional Telegram query options |
1215
1216<a name="TelegramBot+stopPoll"></a>
1217
1218### telegramBot.stopPoll(chatId, pollId, [options]) ⇒ <code>Promise</code>
1219Stop poll.
1220Use this method to stop a native poll.
1221
1222**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1223**See**: https://core.telegram.org/bots/api#stoppoll
1224
1225| Param | Type | Description |
1226| --- | --- | --- |
1227| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the group/channel |
1228| pollId | <code>Number</code> | Identifier of the original message with the poll |
1229| [options] | <code>Object</code> | Additional Telegram query options |
1230
1231<a name="TelegramBot+getFile"></a>
1232
1233### telegramBot.getFile(fileId, [options]) ⇒ <code>Promise</code>
1234Get file.
1235Use this method to get basic info about a file and prepare it for downloading.
1236Attention: link will be valid for 1 hour.
1237
1238**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1239**See**: https://core.telegram.org/bots/api#getfile
1240
1241| Param | Type | Description |
1242| --- | --- | --- |
1243| fileId | <code>String</code> | File identifier to get info about |
1244| [options] | <code>Object</code> | Additional Telegram query options |
1245
1246<a name="TelegramBot+getFileLink"></a>
1247
1248### telegramBot.getFileLink(fileId, [options]) ⇒ <code>Promise</code>
1249Get link for file.
1250Use this method to get link for file for subsequent use.
1251Attention: link will be valid for 1 hour.
1252
1253This method is a sugar extension of the (getFile)[#getfilefileid] method,
1254which returns just path to file on remote server (you will have to manually build full uri after that).
1255
1256**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1257**Returns**: <code>Promise</code> - promise Promise which will have *fileURI* in resolve callback
1258**See**: https://core.telegram.org/bots/api#getfile
1259
1260| Param | Type | Description |
1261| --- | --- | --- |
1262| fileId | <code>String</code> | File identifier to get info about |
1263| [options] | <code>Object</code> | Additional Telegram query options |
1264
1265<a name="TelegramBot+getFileStream"></a>
1266
1267### telegramBot.getFileStream(fileId, [options]) ⇒ <code>stream.Readable</code>
1268Return a readable stream for file.
1269
1270`fileStream.path` is the specified file ID i.e. `fileId`.
1271`fileStream` emits event `info` passing a single argument i.e.
1272`info` with the interface `{ uri }` where `uri` is the URI of the
1273file on Telegram servers.
1274
1275This method is a sugar extension of the [getFileLink](#TelegramBot+getFileLink) method,
1276which returns the full URI to the file on remote server.
1277
1278**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1279**Returns**: <code>stream.Readable</code> - fileStream
1280
1281| Param | Type | Description |
1282| --- | --- | --- |
1283| fileId | <code>String</code> | File identifier to get info about |
1284| [options] | <code>Object</code> | Additional Telegram query options |
1285
1286<a name="TelegramBot+downloadFile"></a>
1287
1288### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ <code>Promise</code>
1289Downloads file in the specified folder.
1290
1291This method is a sugar extension of the [getFileStream](#TelegramBot+getFileStream) method,
1292which returns a readable file stream.
1293
1294**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1295**Returns**: <code>Promise</code> - promise Promise, which will have *filePath* of downloaded file in resolve callback
1296
1297| Param | Type | Description |
1298| --- | --- | --- |
1299| fileId | <code>String</code> | File identifier to get info about |
1300| downloadDir | <code>String</code> | Absolute path to the folder in which file will be saved |
1301| [options] | <code>Object</code> | Additional Telegram query options |
1302
1303<a name="TelegramBot+onText"></a>
1304
1305### telegramBot.onText(regexp, callback)
1306Register a RegExp to test against an incomming text message.
1307
1308**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1309
1310| Param | Type | Description |
1311| --- | --- | --- |
1312| regexp | <code>RegExp</code> | RegExp to be executed with `exec`. |
1313| callback | <code>function</code> | Callback will be called with 2 parameters, the `msg` and the result of executing `regexp.exec` on message text. |
1314
1315<a name="TelegramBot+removeTextListener"></a>
1316
1317### telegramBot.removeTextListener(regexp) ⇒ <code>Object</code>
1318Remove a listener registered with `onText()`.
1319
1320**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1321**Returns**: <code>Object</code> - deletedListener The removed reply listener if
1322 found. This object has `regexp` and `callback`
1323 properties. If not found, returns `null`.
1324
1325| Param | Type | Description |
1326| --- | --- | --- |
1327| regexp | <code>RegExp</code> | RegExp used previously in `onText()` |
1328
1329<a name="TelegramBot+clearTextListeners"></a>
1330
1331### telegramBot.clearTextListeners()
1332Remove all listeners registered with `onText()`.
1333
1334**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1335<a name="TelegramBot+onReplyToMessage"></a>
1336
1337### telegramBot.onReplyToMessage(chatId, messageId, callback) ⇒ <code>Number</code>
1338Register a reply to wait for a message response.
1339
1340**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1341**Returns**: <code>Number</code> - id The ID of the inserted reply listener.
1342
1343| Param | Type | Description |
1344| --- | --- | --- |
1345| chatId | <code>Number</code> \| <code>String</code> | The chat id where the message cames from. |
1346| messageId | <code>Number</code> \| <code>String</code> | The message id to be replied. |
1347| callback | <code>function</code> | Callback will be called with the reply message. |
1348
1349<a name="TelegramBot+removeReplyListener"></a>
1350
1351### telegramBot.removeReplyListener(replyListenerId) ⇒ <code>Object</code>
1352Removes a reply that has been prev. registered for a message response.
1353
1354**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1355**Returns**: <code>Object</code> - deletedListener The removed reply listener if
1356 found. This object has `id`, `chatId`, `messageId` and `callback`
1357 properties. If not found, returns `null`.
1358
1359| Param | Type | Description |
1360| --- | --- | --- |
1361| replyListenerId | <code>Number</code> | The ID of the reply listener. |
1362
1363<a name="TelegramBot+clearReplyListeners"></a>
1364
1365### telegramBot.clearReplyListeners()
1366Removes all replies that have been prev. registered for a message response.
1367
1368**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1369<a name="TelegramBot+getChat"></a>
1370
1371### telegramBot.getChat(chatId, [options]) ⇒ <code>Promise</code>
1372Use this method to get up to date information about the chat
1373(current name of the user for one-on-one conversations, current
1374username of a user, group or channel, etc.).
1375
1376**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1377**See**: https://core.telegram.org/bots/api#getchat
1378
1379| Param | Type | Description |
1380| --- | --- | --- |
1381| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target supergroup or channel |
1382| [options] | <code>Object</code> | Additional Telegram query options |
1383
1384<a name="TelegramBot+getChatAdministrators"></a>
1385
1386### telegramBot.getChatAdministrators(chatId, [options]) ⇒ <code>Promise</code>
1387Returns the administrators in a chat in form of an Array of `ChatMember` objects.
1388
1389**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1390**See**: https://core.telegram.org/bots/api#getchatadministrators
1391
1392| Param | Type | Description |
1393| --- | --- | --- |
1394| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
1395| [options] | <code>Object</code> | Additional Telegram query options |
1396
1397<a name="TelegramBot+getChatMembersCount"></a>
1398
1399### ~~telegramBot.getChatMembersCount(chatId, [options]) ⇒ <code>Promise</code>~~
1400***Deprecated***
1401
1402Use this method to get the number of members in a chat.
1403Returns Int on success.
1404
1405**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1406**See**: https://core.telegram.org/bots/api#getchatmemberscount
1407
1408| Param | Type | Description |
1409| --- | --- | --- |
1410| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
1411| [options] | <code>Object</code> | Additional Telegram query options |
1412
1413<a name="TelegramBot+getChatMemberCount"></a>
1414
1415### telegramBot.getChatMemberCount(chatId, [options]) ⇒ <code>Promise</code>
1416Use this method to get the number of members in a chat.
1417Returns Int on success
1418
1419**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1420**See**: https://core.telegram.org/bots/api#getchatmembercount
1421
1422| Param | Type | Description |
1423| --- | --- | --- |
1424| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
1425| [options] | <code>Object</code> | Additional Telegram query options |
1426
1427<a name="TelegramBot+getChatMember"></a>
1428
1429### telegramBot.getChatMember(chatId, userId, [options]) ⇒ <code>Promise</code>
1430Use this method to get information about a member of a chat.
1431
1432**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1433**See**: https://core.telegram.org/bots/api#getchatmember
1434
1435| Param | Type | Description |
1436| --- | --- | --- |
1437| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup |
1438| userId | <code>Number</code> | Unique identifier of the target user |
1439| [options] | <code>Object</code> | Additional Telegram query options |
1440
1441<a name="TelegramBot+leaveChat"></a>
1442
1443### telegramBot.leaveChat(chatId, [options]) ⇒ <code>Promise</code>
1444Leave a group, supergroup or channel.
1445
1446**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1447**See**: https://core.telegram.org/bots/api#leavechat
1448
1449| Param | Type | Description |
1450| --- | --- | --- |
1451| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
1452| [options] | <code>Object</code> | Additional Telegram query options |
1453
1454<a name="TelegramBot+setChatStickerSet"></a>
1455
1456### telegramBot.setChatStickerSet(chatId, stickerSetName, [options]) ⇒ <code>Promise</code>
1457Use this method to set a new group sticker set for a supergroup.
1458
1459**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1460**See**: https://core.telegram.org/bots/api#setchatstickerset
1461
1462| Param | Type | Description |
1463| --- | --- | --- |
1464| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
1465| stickerSetName | <code>String</code> | Name of the sticker set to be set as the group sticker set |
1466| [options] | <code>Object</code> | Additional Telegram query options |
1467
1468<a name="TelegramBot+deleteChatStickerSet"></a>
1469
1470### telegramBot.deleteChatStickerSet(chatId, [options]) ⇒ <code>Promise</code>
1471Use this method to delete a group sticker set from a supergroup.
1472
1473**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1474**See**: https://core.telegram.org/bots/api#deletechatstickerset
1475
1476| Param | Type | Description |
1477| --- | --- | --- |
1478| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
1479| [options] | <code>Object</code> | Additional Telegram query options |
1480
1481<a name="TelegramBot+sendGame"></a>
1482
1483### telegramBot.sendGame(chatId, gameShortName, [options]) ⇒ <code>Promise</code>
1484Use this method to send a game.
1485
1486**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1487**See**: https://core.telegram.org/bots/api#sendgame
1488
1489| Param | Type | Description |
1490| --- | --- | --- |
1491| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
1492| gameShortName | <code>String</code> | name of the game to be sent. |
1493| [options] | <code>Object</code> | Additional Telegram query options |
1494
1495<a name="TelegramBot+setGameScore"></a>
1496
1497### telegramBot.setGameScore(userId, score, [options]) ⇒ <code>Promise</code>
1498Use this method to set the score of the specified user in a game.
1499
1500**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1501**See**: https://core.telegram.org/bots/api#setgamescore
1502
1503| Param | Type | Description |
1504| --- | --- | --- |
1505| userId | <code>Number</code> | Unique identifier of the target user |
1506| score | <code>Number</code> | New score value. |
1507| [options] | <code>Object</code> | Additional Telegram query options |
1508
1509<a name="TelegramBot+getGameHighScores"></a>
1510
1511### telegramBot.getGameHighScores(userId, [options]) ⇒ <code>Promise</code>
1512Use this method to get data for high score table.
1513
1514**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1515**See**: https://core.telegram.org/bots/api#getgamehighscores
1516
1517| Param | Type | Description |
1518| --- | --- | --- |
1519| userId | <code>Number</code> | Unique identifier of the target user |
1520| [options] | <code>Object</code> | Additional Telegram query options |
1521
1522<a name="TelegramBot+deleteMessage"></a>
1523
1524### telegramBot.deleteMessage(chatId, messageId, [options]) ⇒ <code>Promise</code>
1525Use this method to delete a message.
1526
1527**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1528**See**: https://core.telegram.org/bots/api#deletemessage
1529
1530| Param | Type | Description |
1531| --- | --- | --- |
1532| chatId | <code>Number</code> \| <code>String</code> | Unique identifier of the target chat |
1533| messageId | <code>Number</code> | Unique identifier of the target message |
1534| [options] | <code>Object</code> | Additional Telegram query options |
1535
1536<a name="TelegramBot+sendInvoice"></a>
1537
1538### telegramBot.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options]) ⇒ <code>Promise</code>
1539Send invoice.
1540Use this method to send an invoice.
1541
1542**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1543**See**: https://core.telegram.org/bots/api#sendinvoice
1544
1545| Param | Type | Description |
1546| --- | --- | --- |
1547| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the message recipient |
1548| title | <code>String</code> | Product name |
1549| description | <code>String</code> | product description |
1550| payload | <code>String</code> | Bot defined invoice payload |
1551| providerToken | <code>String</code> | Payments provider token |
1552| startParameter | <code>String</code> | Deep-linking parameter |
1553| currency | <code>String</code> | Three-letter ISO 4217 currency code |
1554| prices | <code>Array</code> | Breakdown of prices |
1555| [options] | <code>Object</code> | Additional Telegram query options |
1556
1557<a name="TelegramBot+answerShippingQuery"></a>
1558
1559### telegramBot.answerShippingQuery(shippingQueryId, ok, [options]) ⇒ <code>Promise</code>
1560Answer shipping query..
1561Use this method to reply to shipping queries.
1562
1563**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1564**See**: https://core.telegram.org/bots/api#answershippingquery
1565
1566| Param | Type | Description |
1567| --- | --- | --- |
1568| shippingQueryId | <code>String</code> | Unique identifier for the query to be answered |
1569| ok | <code>Boolean</code> | Specify if delivery of the product is possible |
1570| [options] | <code>Object</code> | Additional Telegram query options |
1571
1572<a name="TelegramBot+answerPreCheckoutQuery"></a>
1573
1574### telegramBot.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options]) ⇒ <code>Promise</code>
1575Answer pre-checkout query.
1576Use this method to confirm shipping of a product.
1577
1578**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1579**See**: https://core.telegram.org/bots/api#answerprecheckoutquery
1580
1581| Param | Type | Description |
1582| --- | --- | --- |
1583| preCheckoutQueryId | <code>String</code> | Unique identifier for the query to be answered |
1584| ok | <code>Boolean</code> | Specify if every order details are ok |
1585| [options] | <code>Object</code> | Additional Telegram query options |
1586
1587<a name="TelegramBot+getStickerSet"></a>
1588
1589### telegramBot.getStickerSet(name, [options]) ⇒ <code>Promise</code>
1590Use this method to get a sticker set. On success, a [StickerSet](https://core.telegram.org/bots/api#stickerset) object is returned.
1591
1592**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1593**See**: https://core.telegram.org/bots/api#getstickerset
1594
1595| Param | Type | Description |
1596| --- | --- | --- |
1597| name | <code>String</code> | Name of the sticker set |
1598| [options] | <code>Object</code> | Additional Telegram query options |
1599
1600<a name="TelegramBot+uploadStickerFile"></a>
1601
1602### telegramBot.uploadStickerFile(userId, pngSticker, [options], [fileOptions]) ⇒ <code>Promise</code>
1603Use this method to upload a .png file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple
1604times). Returns the uploaded [File](https://core.telegram.org/bots/api#file) on success.
1605
1606**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1607**See**: https://core.telegram.org/bots/api#uploadstickerfile
1608
1609| Param | Type | Description |
1610| --- | --- | --- |
1611| userId | <code>Number</code> | User identifier of sticker file owner |
1612| pngSticker | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or a Stream. Can also be a `file_id` previously uploaded. **Png** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. |
1613| [options] | <code>Object</code> | Additional Telegram query options |
1614| [fileOptions] | <code>Object</code> | Optional file related meta-data |
1615
1616<a name="TelegramBot+createNewStickerSet"></a>
1617
1618### telegramBot.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code>
1619Use this method to create new sticker set owned by a user.
1620The bot will be able to edit the created sticker set.
1621Returns True on success.
1622
1623**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1624**See**: https://core.telegram.org/bots/api#createnewstickerset
1625**Todo**
1626
1627- [ ] Add tests for this method!
1628
1629
1630| Param | Type | Description |
1631| --- | --- | --- |
1632| userId | <code>Number</code> | User identifier of created sticker set owner |
1633| name | <code>String</code> | Short name of sticker set, to be used in `t.me/addstickers/` URLs (e.g., *animals*) |
1634| title | <code>String</code> | Sticker set title, 1-64 characters |
1635| pngSticker | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. |
1636| emojis | <code>String</code> | One or more emoji corresponding to the sticker |
1637| [options] | <code>Object</code> | Additional Telegram query options |
1638| [fileOptions] | <code>Object</code> | Optional file related meta-data |
1639
1640<a name="TelegramBot+addStickerToSet"></a>
1641
1642### telegramBot.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions]) ⇒ <code>Promise</code>
1643Use this method to add a new sticker to a set created by the bot.
1644Returns True on success.
1645
1646**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1647**See**: https://core.telegram.org/bots/api#addstickertoset
1648**Todo**
1649
1650- [ ] Add tests for this method!
1651
1652
1653| Param | Type | Description |
1654| --- | --- | --- |
1655| userId | <code>Number</code> | User identifier of sticker set owner |
1656| name | <code>String</code> | Sticker set name |
1657| pngSticker | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px |
1658| emojis | <code>String</code> | One or more emoji corresponding to the sticker |
1659| [options] | <code>Object</code> | Additional Telegram query options |
1660| [fileOptions] | <code>Object</code> | Optional file related meta-data |
1661
1662<a name="TelegramBot+setStickerPositionInSet"></a>
1663
1664### telegramBot.setStickerPositionInSet(sticker, position, [options]) ⇒ <code>Promise</code>
1665Use this method to move a sticker in a set created by the bot to a specific position.
1666Returns True on success.
1667
1668**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1669**See**: https://core.telegram.org/bots/api#setstickerpositioninset
1670**Todo**
1671
1672- [ ] Add tests for this method!
1673
1674
1675| Param | Type | Description |
1676| --- | --- | --- |
1677| sticker | <code>String</code> | File identifier of the sticker |
1678| position | <code>Number</code> | New sticker position in the set, zero-based |
1679| [options] | <code>Object</code> | Additional Telegram query options |
1680
1681<a name="TelegramBot+deleteStickerFromSet"></a>
1682
1683### telegramBot.deleteStickerFromSet(sticker, [options]) ⇒ <code>Promise</code>
1684Use this method to delete a sticker from a set created by the bot.
1685Returns True on success.
1686
1687**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1688**See**: https://core.telegram.org/bots/api#deletestickerfromset
1689**Todo**
1690
1691- [ ] Add tests for this method!
1692
1693
1694| Param | Type | Description |
1695| --- | --- | --- |
1696| sticker | <code>String</code> | File identifier of the sticker |
1697| [options] | <code>Object</code> | Additional Telegram query options |
1698
1699<a name="TelegramBot+sendMediaGroup"></a>
1700
1701### telegramBot.sendMediaGroup(chatId, media, [options]) ⇒ <code>Promise</code>
1702Use this method to send a group of photos or videos as an album.
1703On success, an array of the sent [Messages](https://core.telegram.org/bots/api#message)
1704is returned.
1705
1706If you wish to [specify file options](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files),
1707add a `fileOptions` property to the target input in `media`.
1708
1709**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1710**See**
1711
1712- https://core.telegram.org/bots/api#sendmediagroup
1713- https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
1714
1715
1716| Param | Type | Description |
1717| --- | --- | --- |
1718| chatId | <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) |
1719| media | <code>Array</code> | A JSON-serialized array describing photos and videos to be sent, must include 2–10 items |
1720| [options] | <code>Object</code> | Additional Telegram query options |
1721
1722<a name="TelegramBot.errors"></a>
1723
1724### TelegramBot.errors : <code>Object</code>
1725The different errors the library uses.
1726
1727**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
1728<a name="TelegramBot.messageTypes"></a>
1729
1730### TelegramBot.messageTypes : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code>
1731The types of message updates the library handles.
1732
1733**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
1734<a name="TelegramBot.Promise"></a>
1735
1736### TelegramBot.Promise
1737Change Promise library used internally, for all existing and new
1738instances.
1739
1740**Kind**: static property of [<code>TelegramBot</code>](#TelegramBot)
1741
1742| Param | Type |
1743| --- | --- |
1744| customPromise | <code>function</code> |
1745
1746**Example**
1747```js
1748const TelegramBot = require('node-telegram-bot-api');
1749TelegramBot.Promise = myPromise;
1750```
1751* * *
1752
1753
1754[usage-sending-files-performance]:https://github.com/yagop/node-telegram-bot-api/tree/master/doc/usage.md#sending-files-performance
1755[setWebHook-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#telegrambotsetwebhookurl-cert
1756[getUpdates-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#TelegramBot+getUpdates
1757[getUserProfilePhotos-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#TelegramBot+getUserProfilePhotos
1758[answerCallbackQuery-v0.27.1]:https://github.com/yagop/node-telegram-bot-api/blob/v0.27.1/doc/api.md#TelegramBot+answerCallbackQuery
1759[answerCallbackQuery-v0.29.0]:https://github.com/yagop/node-telegram-bot-api/blob/v0.29.0/doc/api.md#TelegramBot+answerCallbackQuery