Forward messages + readme

This commit is contained in:
Adhiraj
2020-07-28 16:01:44 +05:30
parent 466346c404
commit 5d15d27053
3 changed files with 11 additions and 2 deletions

View File

@@ -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

View File

@@ -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')

View File

@@ -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]