diff --git a/README.md b/README.md index ad121d9..cae41b6 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,8 @@ To note: ``` ts const info: MessageOptions = { quoted: quotedMessage, // the message you want to quote + contextInfo: { forwardingScore: 2, isForwarded: true }, // some random context info + // (can show a forwarded message with this too) timestamp: Date(), // optional, if you want to manually set the timestamp of the message validateID: true, // if you want to validate the ID before sending the message, true by default caption: "hello there!", // (for media messages) the caption to send with the media (cannot be sent with stickers though) @@ -208,6 +210,13 @@ To note: filename: 'somefile.pdf' // (for media messages) file name for the media } ``` +## Forwarding Messages + +``` ts +const messages = await client.loadConversation ('1234@s.whatsapp.net', 1) +const message = messages[0] // get the last message from this conversation +await client.forwardMessage ('455@s.whatsapp.net', message) // WA forward the message! +``` ## Reading Messages ``` ts diff --git a/src/WAClient/Messages.ts b/src/WAClient/Messages.ts index 1d107c9..b5b30b3 100644 --- a/src/WAClient/Messages.ts +++ b/src/WAClient/Messages.ts @@ -200,7 +200,7 @@ export default class WhatsAppWebMessages extends WhatsAppWebGroups { * @param id the id to forward the message to * @param message the message to forward */ - async forardMessage(id: string, message: WAMessage) { + async forwardMessage(id: string, message: WAMessage) { const content = message.message if (!content) throw new Error ('no content in message') diff --git a/src/WAClient/Tests.ts b/src/WAClient/Tests.ts index 31410e9..7f042df 100644 --- a/src/WAClient/Tests.ts +++ b/src/WAClient/Tests.ts @@ -35,7 +35,7 @@ WAClientTest('Messages', (client) => { }) it('should forward a message', async () => { let messages = await client.loadConversation (testJid, 1) - await client.forardMessage (testJid, messages[0]) + await client.forwardMessage (testJid, messages[0]) messages = await client.loadConversation (testJid, 1) const message = messages[0]