mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Forward messages + readme
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user