Skip to content

Commit

Permalink
feat: Support forwardMessages method
Browse files Browse the repository at this point in the history
  • Loading branch information
danielperez9430 committed Feb 20, 2024
1 parent 00ffca5 commit be25ec6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,27 @@ class TelegramBot extends EventEmitter {
return this._request('forwardMessage', { 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(chatId, fromChatId, messageIds, form = {}) {
form.chat_id = chatId;
form.from_chat_id = fromChatId;
form.message_ids = messageIds;
return this._request('forwardMessages', { 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
Expand Down Expand Up @@ -2994,7 +3015,7 @@ class TelegramBot extends EventEmitter {
* @param {Array<Number|String>} messageIds Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted
* @param {Object} [options] Additional Telegram query options
* @return {Promise<Boolean>} True on success
* @see https://core.telegram.org/bots/api#deleteMessages
* @see https://core.telegram.org/bots/api#deletemessages
*/
deleteMessages(chatId, messageIds, form = {}) {
form.chat_id = chatId;
Expand Down

0 comments on commit be25ec6

Please sign in to comment.