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... | 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... | 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
@para... | 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.teleg... | 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 {... | 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](htt... | 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 ... | 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 f... | 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 t... | 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 ide... | 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 ... | 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... | 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... | 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.... | 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._fixAddFileThumbn... | 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... | 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(o... | 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 Strea... | 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 (... | 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 `fi... | 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 P... | 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.Stre... | 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.... | 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 ... | 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);
... | 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 [InputPa... | 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] Additi... | 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 o... | 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,... | 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... | 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] Add... | 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 quer... | 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 s... | 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#sendmess... | 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 ... | 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-disabl... | 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... | 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 Tele... | 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/... | 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.
@pa... | 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... | 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 th... | 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 usernam... | 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} customTit... | 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... | 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 `@channel... | 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 ... | 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 ... | 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#revokechatinviteli... | 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`)
@... | 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... | 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... | 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 ... | 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`)
@para... | 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`)
@para... | 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) {
retu... | 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 (... | 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 `@c... | 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 for... | 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 `@channel... | 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... | 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 {... | 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} ... | 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.... | 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
@p... | 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/... | 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]... | 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 ... | 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 ta... | 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} ... | 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|Stri... | 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... | 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 targe... | 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 tar... | 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 superg... | 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 th... | 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 ... | 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 ... | 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 targe... | 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 ... | 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 @supe... | 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 supergrou... | 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 ... | 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][answer... | 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 su... | 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} ... | 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.or... | 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.
@... | 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 ... | 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 htt... | 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#setmyshortdescripti... | 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#getmyshortdescrip... | 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 {Promi... | 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#getmydefaultadministratorrig... | 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] Addition... | 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 on... | 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 {
... | 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... | 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 Te... | 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://c... | 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) {
... | 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 `@channelusernam... | sendSticker | javascript | yagop/node-telegram-bot-api | src/telegram.js | https://github.com/yagop/node-telegram-bot-api/blob/master/src/telegram.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.