code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
closeWebHook() { if (!this._webHook) { return Promise.resolve(); } return this._webHook.close(); }
Close webhook after closing all current connections. Multiple invocations do nothing if webhook is already closed. @return {Promise} Promise
closeWebHook
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
hasOpenWebHook() { return this._webHook ? this._webHook.isOpen() : false; }
Return true if using webhook and it is open i.e. accepts connections. Otherwise, false. @return {Boolean}
hasOpenWebHook
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getUpdates(form = {}) { /* The older method signature was getUpdates(timeout, limit, offset). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ if (typeof form !== 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature getUpdates(timeout, limit, offset) has been deprecated since v0.25.0'); form = { timeout: arguments[0], limit: arguments[1], offset: arguments[2], }; /* eslint-enable no-param-reassign, prefer-rest-params */ } return this._request('getUpdates', { form }); }
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. @param {Object} [options] Additional Telegram query options @return {Promise} @see https://core.telegram.org/bots/api#getupdates
getUpdates
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setWebHook(url, options = {}, fileOptions = {}) { /* The older method signature was setWebHook(url, cert). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ let cert; // Note: 'options' could be an object, if a stream was provided (in place of 'cert') if (typeof options !== 'object' || options instanceof stream.Stream) { deprecate('The method signature setWebHook(url, cert) has been deprecated since v0.25.0'); cert = options; options = {}; // eslint-disable-line no-param-reassign } else { cert = options.certificate; } const opts = { qs: options, }; opts.qs.url = url; if (cert) { try { const sendData = this._formatSendData('certificate', cert, fileOptions); opts.formData = sendData[0]; opts.qs.certificate = sendData[1]; } catch (ex) { return Promise.reject(ex); } } return this._request('setWebHook', opts); }
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. @param {String} url URL where Telegram will make HTTP Post. Leave empty to delete webHook. @param {Object} [options] Additional Telegram query options @param {String|stream.Stream} [options.certificate] PEM certificate key (public). @param {String} [options.secret_token] Optional secret token to be sent in a header `X-Telegram-Bot-Api-Secret-Token` in every webhook request. @param {Object} [fileOptions] Optional file related meta-data @return {Promise} @see https://core.telegram.org/bots/api#setwebhook @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
setWebHook
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
deleteWebHook(form = {}) { return this._request('deleteWebhook', { form }); }
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. @param {Object} [options] Additional Telegram query options @return {Promise} @see https://core.telegram.org/bots/api#deletewebhook
deleteWebHook
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getWebHookInfo(form = {}) { return this._request('getWebhookInfo', { form }); }
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. @param {Object} [options] Additional Telegram query options @return {Promise} @see https://core.telegram.org/bots/api#getwebhookinfo
getWebHookInfo
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMe(form = {}) { return this._request('getMe', { form }); }
A simple method for testing your bot's authentication token. Requires no parameters. @param {Object} [options] Additional Telegram query options @return {Promise} basic information about the bot in form of a [User](https://core.telegram.org/bots/api#user) object. @see https://core.telegram.org/bots/api#getme
getMe
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
logOut(form = {}) { return this._request('logOut', { form }); }
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. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#logout
logOut
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
close(form = {}) { return this._request('close', { form }); }
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. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#close
close
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendMessage(chatId, text, form = {}) { form.chat_id = chatId; form.text = text; return this._request('sendMessage', { form }); }
Send text message. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} text Text of the message to be sent @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendmessage
sendMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
forwardMessage(chatId, fromChatId, messageId, form = {}) { form.chat_id = chatId; form.from_chat_id = fromChatId; form.message_id = messageId; return this._request('forwardMessage', { form }); }
Forward messages of any kind. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or username of the target channel (in the format `@channelusername`) @param {Number|String} fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) @param {Number|String} messageId Unique message identifier in the chat specified in fromChatId @param {Object} [options] Additional Telegram query options @return {Promise} @see https://core.telegram.org/bots/api#forwardmessage
forwardMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
forwardMessages(chatId, fromChatId, messageIds, form = {}) { form.chat_id = chatId; form.from_chat_id = fromChatId; form.message_ids = messageIds; return this._request('forwardMessages', { form }); }
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or username of the target channel (in the format `@channelusername`) @param {Number|String} fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) @param {Array<Number|String>} messageIds Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. @param {Object} [options] Additional Telegram query options @return {Promise} An array of MessageId of the sent messages on success @see https://core.telegram.org/bots/api#forwardmessages
forwardMessages
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
copyMessage(chatId, fromChatId, messageId, form = {}) { form.chat_id = chatId; form.from_chat_id = fromChatId; form.message_id = messageId; return this._request('copyMessage', { form }); }
Copy messages of any kind. **Service messages and invoice messages can't be copied.** 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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number|String} fromChatId Unique identifier for the chat where the original message was sent @param {Number|String} messageId Unique message identifier @param {Object} [options] Additional Telegram query options @return {Promise} The [MessageId](https://core.telegram.org/bots/api#messageid) of the sent message on success @see https://core.telegram.org/bots/api#copymessage
copyMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
copyMessages(chatId, fromChatId, messageIds, form = {}) { form.chat_id = chatId; form.from_chat_id = fromChatId; form.message_ids = stringify(messageIds); return this._request('copyMessages', { form }); }
Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. Returns the MessageId of the sent message on success. @param {Number|String} chatId Unique identifier for the target chat @param {Number|String} fromChatId Unique identifier for the chat where the original message was sent @param {Array} messageIds Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. @param {Object} [options] Additional Telegram query options @return {Promise} An array of MessageId of the sent messages @see https://core.telegram.org/bots/api#copymessages
copyMessages
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendPhoto(chatId, photo, options = {}, fileOptions = {}) { const opts = { qs: options, }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('photo', photo, fileOptions); opts.formData = sendData[0]; opts.qs.photo = sendData[1]; } catch (ex) { return Promise.reject(ex); } return this._request('sendPhoto', opts); }
Send photo @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} photo A file path or a Stream. Can also be a `file_id` previously uploaded @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendphoto @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendPhoto
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendAudio(chatId, audio, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('audio', audio, fileOptions); opts.formData = sendData[0]; opts.qs.audio = sendData[1]; this._fixAddFileThumbnail(options, opts); } catch (ex) { return Promise.reject(ex); } return this._request('sendAudio', opts); }
Send audio **Your audio must be in the .MP3 or .M4A format.** @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} audio A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendaudio @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendAudio
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendDocument(chatId, doc, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('document', doc, fileOptions); opts.formData = sendData[0]; opts.qs.document = sendData[1]; this._fixAddFileThumbnail(options, opts); } catch (ex) { return Promise.reject(ex); } return this._request('sendDocument', opts); }
Send Document @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} doc A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendDocument @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendDocument
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendVideo(chatId, video, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('video', video, fileOptions); opts.formData = sendData[0]; opts.qs.video = sendData[1]; this._fixAddFileThumbnail(options, opts); } catch (ex) { return Promise.reject(ex); } return this._request('sendVideo', opts); }
Use this method to send video files, **Telegram clients support mp4 videos** (other formats may be sent as Document). @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} video A file path or Stream. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendvideo @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendVideo
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendAnimation(chatId, animation, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('animation', animation, fileOptions); opts.formData = sendData[0]; opts.qs.animation = sendData[1]; } catch (ex) { return Promise.reject(ex); } return this._request('sendAnimation', opts); }
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} animation A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendanimation @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendAnimation
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendVoice(chatId, voice, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('voice', voice, fileOptions); opts.formData = sendData[0]; opts.qs.voice = sendData[1]; } catch (ex) { return Promise.reject(ex); } return this._request('sendVoice', opts); }
Send voice **Your audio must be in an .OGG file encoded with OPUS**, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document) @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} voice A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendvoice @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendVoice
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendVideoNote(chatId, videoNote, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('video_note', videoNote, fileOptions); opts.formData = sendData[0]; opts.qs.video_note = sendData[1]; this._fixAddFileThumbnail(options, opts); } catch (ex) { return Promise.reject(ex); } return this._request('sendVideoNote', opts); }
Use this method to send video messages Telegram clients support **rounded square MPEG4 videos** of up to 1 minute long. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} videoNote A file path or Stream. Can also be a `file_id` previously uploaded. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @info The length parameter is actually optional. However, the API (at time of writing) requires you to always provide it until it is fixed. @see https://core.telegram.org/bots/api#sendvideonote @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
sendVideoNote
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendPaidMedia(chatId, starCount, media, options = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; opts.qs.star_count = starCount; try { const inputPaidMedia = []; opts.formData = {}; const { formData, fileIds } = this._formatSendMultipleData('media', media); opts.formData = formData; inputPaidMedia.push(...media.map((item, index) => { if (fileIds[index]) { item.media = fileIds[index]; } else { item.media = `attach://media_${index}`; } return item; })); opts.qs.media = stringify(inputPaidMedia); } catch (ex) { return Promise.reject(ex); } return this._request('sendPaidMedia', opts); }
Use this method to send paid media. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} starCount The number of Telegram Stars that must be paid to buy access to the media; 1-10000 @param {Array} media Array of [InputPaidMedia](https://core.telegram.org/bots/api#inputpaidmedia). The media property can bea String, Stream or Buffer. @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendpaidmedia
sendPaidMedia
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendLocation(chatId, latitude, longitude, form = {}) { form.chat_id = chatId; form.latitude = latitude; form.longitude = longitude; return this._request('sendLocation', { form }); }
Send location. Use this method to send point on the map. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Float} latitude Latitude of location @param {Float} longitude Longitude of location @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendlocation
sendLocation
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editMessageLiveLocation(latitude, longitude, form = {}) { form.latitude = latitude; form.longitude = longitude; return this._request('editMessageLiveLocation', { form }); }
Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location **can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation](https://core.telegram.org/bots/api#stopmessagelivelocation)** Note that you must provide one of chat_id, message_id, or inline_message_id in your request. @param {Float} latitude Latitude of location @param {Float} longitude Longitude of location @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned. @see https://core.telegram.org/bots/api#editmessagelivelocation
editMessageLiveLocation
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
stopMessageLiveLocation(form = {}) { return this._request('stopMessageLiveLocation', { form }); }
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. @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned. @see https://core.telegram.org/bots/api#stopmessagelivelocation
stopMessageLiveLocation
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendVenue(chatId, latitude, longitude, title, address, form = {}) { form.chat_id = chatId; form.latitude = latitude; form.longitude = longitude; form.title = title; form.address = address; return this._request('sendVenue', { form }); }
Send venue. Use this method to send information about a venue. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Float} latitude Latitude of location @param {Float} longitude Longitude of location @param {String} title Name of the venue @param {String} address Address of the venue @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned. @see https://core.telegram.org/bots/api#sendvenue
sendVenue
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendContact(chatId, phoneNumber, firstName, form = {}) { form.chat_id = chatId; form.phone_number = phoneNumber; form.first_name = firstName; return this._request('sendContact', { form }); }
Send contact. Use this method to send phone contacts. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} phoneNumber Contact's phone number @param {String} firstName Contact's first name @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendcontact
sendContact
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendPoll(chatId, question, pollOptions, form = {}) { form.chat_id = chatId; form.question = question; form.options = stringify(pollOptions); return this._request('sendPoll', { form }); }
Send poll. Use this method to send a native poll. @param {Number|String} chatId Unique identifier for the group/channel @param {String} question Poll question, 1-300 characters @param {Array} pollOptions Poll options, between 2-10 options (only 1-100 characters each) @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#sendpoll
sendPoll
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendDice(chatId, options = {}) { const opts = { qs: options, }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('dice'); opts.formData = sendData[0]; } catch (ex) { return Promise.reject(ex); } return this._request('sendDice', opts); }
Send Dice Use this method to send an animated emoji that will display a random value. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned @see https://core.telegram.org/bots/api#senddice
sendDice
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendChatAction(chatId, action, form = {}) { form.chat_id = chatId; form.action = action; return this._request('sendChatAction', { form }); }
Send chat action. Use this method when you need to tell the user that something is happening on the bot's side. **The status is set for 5 seconds or less** (when a message arrives from your bot, Telegram clients clear its typing status). Action `typing` for [text messages](https://core.telegram.org/bots/api#sendmessage), `upload_photo` for [photos](https://core.telegram.org/bots/api#sendphoto), `record_video` or `upload_video` for [videos](https://core.telegram.org/bots/api#sendvideo), `record_voice` or `upload_voice` for [voice notes](https://core.telegram.org/bots/api#sendvoice), `upload_document` for [general files](https://core.telegram.org/bots/api#senddocument), `choose_sticker` for [stickers](https://core.telegram.org/bots/api#sendsticker), `find_location` for [location data](https://core.telegram.org/bots/api#sendlocation), `record_video_note` or `upload_video_note` for [video notes](https://core.telegram.org/bots/api#sendvideonote). @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} action Type of action to broadcast. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#sendchataction
sendChatAction
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMessageReaction(chatId, messageId, form = {}) { form.chat_id = chatId; form.message_id = messageId; if (form.reaction) { form.reaction = stringify(form.reaction); } return this._request('setMessageReaction', { form }); }
Use this method to change the chosen reactions on a message. - Service messages can't be reacted to. - Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. - In albums, bots must react to the first message. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername) @param {Number} messageId Unique identifier of the target message @param {Object} [options] Additional Telegram query options @return {Promise<Boolean>} True on success @see https://core.telegram.org/bots/api#setmessagereaction
setMessageReaction
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getUserProfilePhotos(userId, form = {}) { /* The older method signature was getUserProfilePhotos(userId, offset, limit). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ if (typeof form !== 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature getUserProfilePhotos(userId, offset, limit) has been deprecated since v0.25.0'); form = { offset: arguments[1], limit: arguments[2], }; /* eslint-enable no-param-reassign, prefer-rest-params */ } form.user_id = userId; return this._request('getUserProfilePhotos', { form }); }
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. @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object @see https://core.telegram.org/bots/api#getuserprofilephotos
getUserProfilePhotos
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setUserEmojiStatus(userId, form = {}) { form.user_id = userId; return this._request('setUserEmojiStatus', { form }); }
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method [requestEmojiStatusAccess](https://core.telegram.org/bots/webapps#initializing-mini-apps). @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setuseremojistatus
setUserEmojiStatus
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getFile(fileId, form = {}) { form.file_id = fileId; return this._request('getFile', { form }); }
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.** @param {String} fileId File identifier to get info about @param {Object} [options] Additional Telegram query options @return {Promise} On success, a [File](https://core.telegram.org/bots/api#file) object is returned @see https://core.telegram.org/bots/api#getfile
getFile
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
banChatMember(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('banChatMember', { form }); }
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first.. The **bot must be an administrator in the group, supergroup or a channel** for this to work. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success. @see https://core.telegram.org/bots/api#banchatmember
banChatMember
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unbanChatMember(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('unbanChatMember', { form }); }
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 supergroup or channel for this to work. **By default**, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So **if the user is a member of the chat they will also be removed from the chat**. If you don't want this, use the parameter *only_if_banned* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unbanchatmember
unbanChatMember
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
restrictChatMember(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('restrictChatMember', { form }); }
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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#restrictchatmember
restrictChatMember
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
promoteChatMember(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('promoteChatMember', { form }); }
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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId @param {Object} [options] Additional Telegram query options @return {Promise} True on success. @see https://core.telegram.org/bots/api#promotechatmember
promoteChatMember
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatAdministratorCustomTitle(chatId, userId, customTitle, form = {}) { form.chat_id = chatId; form.user_id = userId; form.custom_title = customTitle; return this._request('setChatAdministratorCustomTitle', { form }); }
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {String} customTitle New custom title for the administrator; 0-16 characters, emoji are not allowed @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
setChatAdministratorCustomTitle
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
banChatSenderChat(chatId, senderChatId, form = {}) { form.chat_id = chatId; form.sender_chat_id = senderChatId; return this._request('banChatSenderChat', { form }); }
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is [unbanned](https://core.telegram.org/bots/api#unbanchatsenderchat), the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot **must be an administrator in the supergroup or channel** for this to work and must have the appropriate administrator rights @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} senderChatId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success. @see https://core.telegram.org/bots/api#banchatsenderchat
banChatSenderChat
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unbanChatSenderChat(chatId, senderChatId, form = {}) { form.chat_id = chatId; form.sender_chat_id = senderChatId; return this._request('unbanChatSenderChat', { form }); }
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot **must be an administrator** for this to work and must have the appropriate administrator rights. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} senderChatId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unbanchatsenderchat
unbanChatSenderChat
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatPermissions(chatId, chatPermissions, form = {}) { form.chat_id = chatId; form.permissions = stringify(chatPermissions); return this._request('setChatPermissions', { form }); }
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.** @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Array} chatPermissions New default chat permissions @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatpermissions
setChatPermissions
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
exportChatInviteLink(chatId, form = {}) { form.chat_id = chatId; return this._request('exportChatInviteLink', { form }); }
Use this method to generate a new primary invite link for a chat. **Any previously generated primary link is revoked**. The bot **must be an administrator in the chat** for this to work and must have the appropriate administrator rights. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} Exported invite link as String on success. @see https://core.telegram.org/bots/api#exportchatinvitelink
exportChatInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
createChatInviteLink(chatId, form = {}) { form.chat_id = chatId; return this._request('createChatInviteLink', { 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. The link generated with this method can be revoked using the method [revokeChatInviteLink](https://core.telegram.org/bots/api#revokechatinvitelink) @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Object} The new invite link as [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object @see https://core.telegram.org/bots/api#createchatinvitelink
createChatInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editChatInviteLink(chatId, inviteLink, form = {}) { form.chat_id = chatId; form.invite_link = inviteLink; return this._request('editChatInviteLink', { 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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} inviteLink Text with the invite link to edit @param {Object} [options] Additional Telegram query options @return {Promise} The edited invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object @see https://core.telegram.org/bots/api#editchatinvitelink
editChatInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
createChatSubscriptionInviteLink(chatId, subscriptionPeriod, subscriptionPrice, form = {}) { form.chat_id = chatId; form.subscription_period = subscriptionPeriod; form.subscription_price = subscriptionPrice; return this._request('createChatSubscriptionInviteLink', { form }); }
Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} subscriptionPeriod The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days) @param {Number} subscriptionPrice The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat (1-2500) @param {Object} [options] Additional Telegram query options @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
createChatSubscriptionInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editChatSubscriptionInviteLink(chatId, inviteLink, form = {}) { form.chat_id = chatId; form.invite_link = inviteLink; return this._request('editChatSubscriptionInviteLink', { form }); }
Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} inviteLink The invite link to edit @param {Object} [options] Additional Telegram query options @return {Promise} The new invite link as a [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
editChatSubscriptionInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
revokeChatInviteLink(chatId, inviteLink, form = {}) { form.chat_id = chatId; form.invite_link = inviteLink; return this._request('revokeChatInviteLink', { 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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} inviteLink The invite link to revoke @param {Object} [options] Additional Telegram query options @return {Promise} The revoked invite link as [ChatInviteLink](https://core.telegram.org/bots/api#chatinvitelink) object @see https://core.telegram.org/bots/api#revokechatinvitelink
revokeChatInviteLink
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
approveChatJoinRequest(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('approveChatJoinRequest', { form }); }
Use this method to approve a chat join request. The bot **must be an administrator in the chat** for this to work and **must have the `can_invite_users` administrator right.** @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#approvechatjoinrequest
approveChatJoinRequest
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
declineChatJoinRequest(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('declineChatJoinRequest', { form }); }
Use this method to decline a chat join request. The bot **must be an administrator in the chat** for this to work and **must have the `can_invite_users` administrator right**. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#declinechatjoinrequest
declineChatJoinRequest
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatPhoto(chatId, photo, options = {}, fileOptions = {}) { const opts = { qs: options, }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('photo', photo, fileOptions); opts.formData = sendData[0]; opts.qs.photo = sendData[1]; } catch (ex) { return Promise.reject(ex); } return this._request('setChatPhoto', opts); }
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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {stream.Stream|Buffer} photo A file path or a Stream. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatphoto
setChatPhoto
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
deleteChatPhoto(chatId, form = {}) { form.chat_id = chatId; return this._request('deleteChatPhoto', { form }); }
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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#deletechatphoto
deleteChatPhoto
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatTitle(chatId, title, form = {}) { form.chat_id = chatId; form.title = title; return this._request('setChatTitle', { form }); }
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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} title New chat title, 1-255 characters @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchattitle
setChatTitle
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatDescription(chatId, description, form = {}) { form.chat_id = chatId; form.description = description; return this._request('setChatDescription', { form }); }
Use this method to change the description of a group, 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. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String} description New chat title, 0-255 characters @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatdescription
setChatDescription
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
pinChatMessage(chatId, messageId, form = {}) { form.chat_id = chatId; form.message_id = messageId; return this._request('pinChatMessage', { form }); }
Use this method to pin a message in a supergroup. If the chat is not a private chat, the **bot must be an administrator in the chat** for this to work and must have the `can_pin_messages` administrator right in a supergroup or `can_edit_messages` administrator right in a channel. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Number} messageId Identifier of a message to pin @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#pinchatmessage
pinChatMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unpinChatMessage(chatId, form = {}) { form.chat_id = chatId; return this._request('unpinChatMessage', { form }); }
Use this method to remove a message from the list of pinned messages in a chat If the chat is not a private chat, the **bot must be an administrator in the chat** for this to work and must have the `can_pin_messages` administrator right in a supergroup or `can_edit_messages` administrator right in a channel. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unpinchatmessage
unpinChatMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unpinAllChatMessages(chatId, form = {}) { form.chat_id = chatId; return this._request('unpinAllChatMessages', { form }); }
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the **bot must be an administrator in the chat** for this to work and must have the `can_pin_messages` administrator right in a supergroup or `can_edit_messages` administrator right in a channel. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unpinallchatmessages
unpinAllChatMessages
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
leaveChat(chatId, form = {}) { form.chat_id = chatId; return this._request('leaveChat', { form }); }
Use this method for your bot to leave a group, supergroup or channel @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#leavechat
leaveChat
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getChat(chatId, form = {}) { form.chat_id = chatId; return this._request('getChat', { form }); }
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.). @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or channel @param {Object} [options] Additional Telegram query options @return {Promise} [ChatFullInfo](https://core.telegram.org/bots/api#chatfullinfo) object on success @see https://core.telegram.org/bots/api#getchat
getChat
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getChatAdministrators(chatId, form = {}) { form.chat_id = chatId; return this._request('getChatAdministrators', { form }); }
Use this method to get a list of administrators in a chat @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup @param {Object} [options] Additional Telegram query options @return {Promise} On success, returns an Array of [ChatMember](https://core.telegram.org/bots/api#chatmember) objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned @see https://core.telegram.org/bots/api#getchatadministrators
getChatAdministrators
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getChatMemberCount(chatId, form = {}) { form.chat_id = chatId; return this._request('getChatMemberCount', { form }); }
Use this method to get the number of members in a chat. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup @param {Object} [options] Additional Telegram query options @return {Promise} Int on success @see https://core.telegram.org/bots/api#getchatmembercount
getChatMemberCount
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getChatMember(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('getChatMember', { form }); }
Use this method to get information about a member of a chat. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} [ChatMember](https://core.telegram.org/bots/api#chatmember) object on success @see https://core.telegram.org/bots/api#getchatmember
getChatMember
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatStickerSet(chatId, stickerSetName, form = {}) { form.chat_id = chatId; form.sticker_set_name = stickerSetName; return this._request('setChatStickerSet', { form }); }
Use this method to set a new group sticker set for a supergroup. The bot **must be an administrator in the chat** for this to work and must have the appropriate administrator rights. **Note:** Use the field `can_set_sticker_set` optionally returned in [getChat](https://core.telegram.org/bots/api#getchat) requests to check if the bot can use this method. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {String} stickerSetName Name of the sticker set to be set as the group sticker set @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatstickerset
setChatStickerSet
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
deleteChatStickerSet(chatId, form = {}) { form.chat_id = chatId; return this._request('deleteChatStickerSet', { form }); }
Use this method to delete a group sticker set from a supergroup. Use the field `can_set_sticker_set` optionally returned in [getChat](https://core.telegram.org/bots/api#getchat) requests to check if the bot can use this method. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#deletechatstickerset
deleteChatStickerSet
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getForumTopicIconStickers(chatId, form = {}) { form.chat_id = chatId; return this._request('getForumTopicIconStickers', { form }); }
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} Array of [Sticker](https://core.telegram.org/bots/api#sticker) objects @see https://core.telegram.org/bots/api#getforumtopiciconstickers
getForumTopicIconStickers
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
createForumTopic(chatId, name, form = {}) { form.chat_id = chatId; form.name = name; return this._request('createForumTopic', { form }); }
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a [ForumTopic](https://core.telegram.org/bots/api#forumtopic) object. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {String} name Topic name, 1-128 characters @param {Object} [options] Additional Telegram query options @see https://core.telegram.org/bots/api#createforumtopic
createForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editForumTopic(chatId, messageThreadId, form = {}) { form.chat_id = chatId; form.message_thread_id = messageThreadId; return this._request('editForumTopic', { form }); }
Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#editforumtopic
editForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
closeForumTopic(chatId, messageThreadId, form = {}) { form.chat_id = chatId; form.message_thread_id = messageThreadId; return this._request('closeForumTopic', { form }); }
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#closeforumtopic
closeForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
reopenForumTopic(chatId, messageThreadId, form = {}) { form.chat_id = chatId; form.message_thread_id = messageThreadId; return this._request('reopenForumTopic', { form }); }
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#reopenforumtopic
reopenForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
deleteForumTopic(chatId, messageThreadId, form = {}) { form.chat_id = chatId; form.message_thread_id = messageThreadId; return this._request('deleteForumTopic', { form }); }
Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#deleteforumtopic
deleteForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unpinAllForumTopicMessages(chatId, messageThreadId, form = {}) { form.chat_id = chatId; form.message_thread_id = messageThreadId; return this._request('unpinAllForumTopicMessages', { form }); }
Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
unpinAllForumTopicMessages
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editGeneralForumTopic(chatId, name, form = {}) { form.chat_id = chatId; form.name = name; return this._request('editGeneralForumTopic', { form }); }
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {String} name New topic name, 1-128 characters @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#editgeneralforumtopic
editGeneralForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
closeGeneralForumTopic(chatId, form = {}) { form.chat_id = chatId; return this._request('closeGeneralForumTopic', { form }); }
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#closegeneralforumtopic
closeGeneralForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
reopenGeneralForumTopic(chatId, form = {}) { form.chat_id = chatId; return this._request('reopenGeneralForumTopic', { form }); }
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#reopengeneralforumtopic
reopenGeneralForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
hideGeneralForumTopic(chatId, form = {}) { form.chat_id = chatId; return this._request('hideGeneralForumTopic', { form }); }
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#hidegeneralforumtopic
hideGeneralForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unhideGeneralForumTopic(chatId, form = {}) { form.chat_id = chatId; return this._request('unhideGeneralForumTopic', { form }); }
Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
unhideGeneralForumTopic
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
unpinAllGeneralForumTopicMessages(chatId, form = {}) { form.chat_id = chatId; return this._request('unhideGeneralForumTopic', { form }); }
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
unpinAllGeneralForumTopicMessages
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
answerCallbackQuery(callbackQueryId, form = {}) { /* The older method signature (in/before v0.27.1) was answerCallbackQuery(callbackQueryId, text, showAlert). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library */ if (typeof form !== 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature answerCallbackQuery(callbackQueryId, text, showAlert) has been deprecated since v0.27.1'); form = { callback_query_id: arguments[0], text: arguments[1], show_alert: arguments[2], }; /* eslint-enable no-param-reassign, prefer-rest-params */ } /* The older method signature (in/before v0.29.0) was answerCallbackQuery([options]). * We need to ensure backwards-compatibility while maintaining * consistency of the method signatures throughout the library. */ if (typeof callbackQueryId === 'object') { /* eslint-disable no-param-reassign, prefer-rest-params */ deprecate('The method signature answerCallbackQuery([options]) has been deprecated since v0.29.0'); form = callbackQueryId; /* eslint-enable no-param-reassign, prefer-rest-params */ } else { form.callback_query_id = callbackQueryId; } return this._request('answerCallbackQuery', { form }); }
Use this method to send answers to callback queries sent from [inline keyboards](https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating). The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. This method has **older, compatible signatures ([1][answerCallbackQuery-v0.27.1])([2][answerCallbackQuery-v0.29.0])** that are being deprecated. @param {String} callbackQueryId Unique identifier for the query to be answered @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#answercallbackquery
answerCallbackQuery
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
savePreparedInlineMessage(userId, result, form = {}) { form.user_id = userId; form.result = stringify(result); return this._request('savePreparedInlineMessage', { form }); }
Use this method to stores a message that can be sent by a user of a Mini App. @param {Number} userId Unique identifier of the target user @param {InlineQueryResult} result object that represents one result of an inline query @param {Object} [options] Optional form data to include in the request @return {Promise} On success, returns a [PreparedInlineMessage](https://core.telegram.org/bots/api#preparedinlinemessage) object. @see https://core.telegram.org/bots/api#savepreparedinlinemessage
savePreparedInlineMessage
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getUserChatBoosts(chatId, userId, form = {}) { form.chat_id = chatId; form.user_id = userId; return this._request('getUserChatBoosts', { form }); }
Use this method to get the list of boosts added to a chat by a use. Requires administrator rights in the chat @param {Number|String} chatId Unique identifier for the group/channel @param {Number} userId Unique identifier of the target user @param {Object} [options] Additional Telegram query options @return {Promise} On success, returns a [UserChatBoosts](https://core.telegram.org/bots/api#userchatboosts) object @see https://core.telegram.org/bots/api#getuserchatboosts
getUserChatBoosts
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getBusinessConnection(businessConnectionId, form = {}) { form.business_connection_id = businessConnectionId; return this._request('getBusinessConnection', { form }); }
Use this method to get information about the connection of the bot with a business account @param {Number|String} businessConnectionId Unique identifier for the group/channel @param {Object} [options] Additional Telegram query options @return {Promise} On success, returns [BusinessConnection](https://core.telegram.org/bots/api#businessconnection) object @see https://core.telegram.org/bots/api#getbusinessconnection
getBusinessConnection
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMyCommands(commands, form = {}) { form.commands = stringify(commands); if (form.scope) { form.scope = stringify(form.scope); } return this._request('setMyCommands', { form }); }
Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands @param {Array} commands List of bot commands to be set as the list of the [bot's commands](https://core.telegram.org/bots/api#botcommand). At most 100 commands can be specified. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setmycommands
setMyCommands
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
deleteMyCommands(form = {}) { return this._request('deleteMyCommands', { form }); }
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, [higher level commands](https://core.telegram.org/bots/api#determining-list-of-commands) will be shown to affected users. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#deletemycommands
deleteMyCommands
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMyCommands(form = {}) { if (form.scope) { form.scope = stringify(form.scope); } return this._request('getMyCommands', { form }); }
Use this method to get the current list of the bot's commands for the given scope and user language. @param {Object} [options] Additional Telegram query options @return {Promise} Array of [BotCommand](https://core.telegram.org/bots/api#botcommand) on success. If commands aren't set, an empty list is returned. @see https://core.telegram.org/bots/api#getmycommands
getMyCommands
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMyName(form = {}) { return this._request('setMyName', { form }); }
Use this method to change the bot's name. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setmyname
setMyName
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMyName(form = {}) { return this._request('getMyName', { form }); }
Use this method to get the current bot name for the given user language. @param {Object} [options] Additional Telegram query options @return {Promise} [BotName](https://core.telegram.org/bots/api#botname) on success @see https://core.telegram.org/bots/api#getmyname
getMyName
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMyDescription(form = {}) { return this._request('setMyDescription', { form }); }
Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setmydescription
setMyDescription
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMyDescription(form = {}) { return this._request('getMyDescription', { form }); }
Use this method to get the current bot description for the given user language. @param {Object} [options] Additional Telegram query options @return {Promise} Returns [BotDescription](https://core.telegram.org/bots/api#botdescription) on success. @see https://core.telegram.org/bots/api#getmydescription
getMyDescription
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMyShortDescription(form = {}) { return this._request('setMyShortDescription', { form }); }
Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. @param {Object} [options] Additional Telegram query options @return {Promise} Returns True on success. @see https://core.telegram.org/bots/api#setmyshortdescription
setMyShortDescription
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMyShortDescription(form = {}) { return this._request('getMyShortDescription', { form }); }
Use this method to get the current bot short description for the given user language. @param {Object} [options] Additional Telegram query options @return {Promise} Returns [BotShortDescription](https://core.telegram.org/bots/api#botshortdescription) on success. @see https://core.telegram.org/bots/api#getmyshortdescription
getMyShortDescription
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setChatMenuButton(form = {}) { return this._request('setChatMenuButton', { form }); }
Use this method to change the bot's menu button in a private chat, or the default menu button. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#setchatmenubutton
setChatMenuButton
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getChatMenuButton(form = {}) { return this._request('getChatMenuButton', { form }); }
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. @param {Object} [options] Additional Telegram query options @return {Promise} [MenuButton](https://core.telegram.org/bots/api#menubutton) on success @see https://core.telegram.org/bots/api#getchatmenubutton
getChatMenuButton
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
setMyDefaultAdministratorRights(form = {}) { return this._request('setMyDefaultAdministratorRights', { form }); }
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. @param {Object} [options] Additional Telegram query options @return {Promise} True on success @see https://core.telegram.org/bots/api#getchatmenubutton
setMyDefaultAdministratorRights
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
getMyDefaultAdministratorRights(form = {}) { return this._request('getMyDefaultAdministratorRights', { form }); }
Use this method to get the current default administrator rights of the bot. @param {Object} [options] Additional Telegram query options @return {Promise} [ChatAdministratorRights](https://core.telegram.org/bots/api#chatadministratorrights) on success @see https://core.telegram.org/bots/api#getmydefaultadministratorrights
getMyDefaultAdministratorRights
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editMessageText(text, form = {}) { form.text = text; return this._request('editMessageText', { form }); }
Use this method to edit text or [game](https://core.telegram.org/bots/api#games) 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. @param {String} text New text of the message @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned @see https://core.telegram.org/bots/api#editmessagetext
editMessageText
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editMessageCaption(caption, form = {}) { form.caption = caption; return this._request('editMessageCaption', { form }); }
Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). Note: You **must provide one of chat_id, message_id, or inline_message_id** in your request. @param {String} caption New caption of the message @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned @see https://core.telegram.org/bots/api#editmessagecaption
editMessageCaption
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editMessageMedia(media, form = {}) { const regexAttach = /attach:\/\/.+/; if (typeof media.media === 'string' && regexAttach.test(media.media)) { const opts = { qs: form, }; opts.formData = {}; const payload = Object.assign({}, media); delete payload.media; try { const attachName = String(0); const [formData] = this._formatSendData( attachName, media.media.replace('attach://', ''), media.fileOptions ); if (formData) { opts.formData[attachName] = formData[attachName]; payload.media = `attach://${attachName}`; } else { throw new errors.FatalError(`Failed to process the replacement action for your ${media.type}`); } } catch (ex) { return Promise.reject(ex); } opts.qs.media = stringify(payload); return this._request('editMessageMedia', opts); } form.media = stringify(media); return this._request('editMessageMedia', { form }); }
Use this method to edit animation, 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. Note: You **must provide one of chat_id, message_id, or inline_message_id** in your request. @param {Object} media A JSON-serialized object for a new media content of the message @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned @see https://core.telegram.org/bots/api#editmessagemedia
editMessageMedia
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
editMessageReplyMarkup(replyMarkup, form = {}) { form.reply_markup = replyMarkup; return this._request('editMessageReplyMarkup', { form }); }
Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). Note: You **must provide one of chat_id, message_id, or inline_message_id** in your request. @param {Object} replyMarkup A JSON-serialized object for an inline keyboard. @param {Object} [options] Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) @return {Promise} On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned @see https://core.telegram.org/bots/api#editmessagetext
editMessageReplyMarkup
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
stopPoll(chatId, pollId, form = {}) { form.chat_id = chatId; form.message_id = pollId; return this._request('stopPoll', { form }); }
Use this method to stop a poll which was sent by the bot. @param {Number|String} chatId Unique identifier for the group/channel @param {Number} pollId Identifier of the original message with the poll @param {Object} [options] Additional Telegram query options @return {Promise} On success, the stopped [Poll](https://core.telegram.org/bots/api#poll) is returned @see https://core.telegram.org/bots/api#stoppoll
stopPoll
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT
sendSticker(chatId, sticker, options = {}, fileOptions = {}) { const opts = { qs: options }; opts.qs.chat_id = chatId; try { const sendData = this._formatSendData('sticker', sticker, fileOptions); opts.formData = sendData[0]; opts.qs.sticker = sendData[1]; } catch (ex) { return Promise.reject(ex); } return this._request('sendSticker', opts); }
Use this method to send static .WEBP, [animated](https://telegram.org/blog/animated-stickers) .TGS, or [video](https://telegram.org/blog/video-stickers-better-reactions) .WEBM stickers. @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) @param {String|stream.Stream|Buffer} sticker A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. Stickers are WebP format files. @param {Object} [options] Additional Telegram query options @param {Object} [fileOptions] Optional file related meta-data @return {Promise} On success, the sent [Message](https://core.telegram.org/bots/api#message) is returned @see https://core.telegram.org/bots/api#sendsticker
sendSticker
javascript
yagop/node-telegram-bot-api
src/telegram.js
https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js
MIT