Skip to content

Commit

Permalink
Add ForwardMessages method
Browse files Browse the repository at this point in the history
  • Loading branch information
olegius88 committed Jan 18, 2023
1 parent 1e58047 commit 35c9646
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/utils/MessageAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,29 @@ class MessageAPI {
return response.data
}

/**
* The method is intended for forwarding messages to a personal or group chat
* @param {String} chatId
* @param {String} chatIdFrom
* @param {Array} messages
*/
async forwardMessages (chatId, chatIdFrom, messages) {
CommonUtils.validateString('chatId', chatId)
CommonUtils.validateString('chatIdFrom', chatIdFrom)
CommonUtils.validateArray('messages', messages);

const method = 'ForwardMessages';

const postData = {
'chatId': chatId,
'chatIdFrom': chatIdFrom,
'messages': messages,
}

const response = await axios.post(CommonUtils.generateMethodURL(this._restAPI.params, method), postData);
return response.data
}

addChadIdParam(postData, chatId) {
if (chatId) {
postData.chatId = chatId
Expand Down

0 comments on commit 35c9646

Please sign in to comment.