mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 19:49:16 +00:00
4
index.d.ts
vendored
4
index.d.ts
vendored
@@ -485,6 +485,10 @@ declare namespace WAWebJS {
|
||||
* If not, it will send the message in the same Chat as the original message was sent.
|
||||
*/
|
||||
reply: (content: MessageContent, chatId?: string, options?: MessageSendOptions) => Promise<Message>,
|
||||
/**
|
||||
* Forwards this message to another chat
|
||||
*/
|
||||
forward: (chat: Chat | string) => Promise,
|
||||
}
|
||||
|
||||
/** ID that represents a message */
|
||||
|
||||
@@ -190,6 +190,23 @@ class Message extends Base {
|
||||
return this.client.sendMessage(chatId, content, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards this message to another chat
|
||||
*
|
||||
* @param {string|Chat} chat Chat model or chat ID to which the message will be forwarded
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async forward(chat) {
|
||||
const chatId = typeof chat === 'string' ? chat : chat.id._serialized;
|
||||
|
||||
await this.client.pupPage.evaluate(async (msgId, chatId) => {
|
||||
let msg = window.Store.Msg.get(msgId);
|
||||
let chat = window.Store.Chat.get(chatId);
|
||||
|
||||
return await chat.forwardMessages([msg]);
|
||||
}, this.id._serialized, chatId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads and returns the attatched message media
|
||||
* @returns {Promise<MessageMedia>}
|
||||
|
||||
Reference in New Issue
Block a user