Skip to content

Commit

Permalink
added usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
ALΞX committed Jun 10, 2023
1 parent eaf5072 commit 9456c65
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions example.js
Expand Up @@ -202,6 +202,20 @@ client.on('message', async msg => {
} else if (msg.body === '!reaction') {
msg.react('👍');
}
else if (msg.author) {
/** Note: forwarding with caption is available for media messages (photo/video) only. */

/**
* Let's say the message was sent in a group
* and I want to forward it to its author.
*/

// 1. By default it will be forwarded without a caption text (even if provided):
await msg.forward(msg.author)

Check failure on line 214 in example.js

View workflow job for this annotation

GitHub Actions / ESLint

Missing semicolon

// 2. To forward with a caption text of original message (if provided) do:
await msg.forward(msg.author, { withCaption: true })

Check failure on line 217 in example.js

View workflow job for this annotation

GitHub Actions / ESLint

Missing semicolon
}
});

client.on('message_create', (msg) => {
Expand Down

0 comments on commit 9456c65

Please sign in to comment.