feat: send photo/video as a view once message (#2317)
* added isViewOnce property * docs updated * added usage example * fix: ESLint
This commit is contained in:
parent
c8c2f09f20
commit
8ff5bceca0
2 changed files with 16 additions and 4 deletions
|
|
@ -238,9 +238,9 @@ class Client extends EventEmitter {
|
|||
// Listens to qr token change
|
||||
if (mut.type === 'attributes' && mut.attributeName === 'data-ref') {
|
||||
window.qrChanged(mut.target.dataset.ref);
|
||||
} else
|
||||
}
|
||||
// Listens to retry button, when found, click it
|
||||
if (mut.type === 'childList') {
|
||||
else if (mut.type === 'childList') {
|
||||
const retry_button = document.querySelector(selectors.QR_RETRY_BUTTON);
|
||||
if (retry_button) retry_button.click();
|
||||
}
|
||||
|
|
@ -738,6 +738,7 @@ class Client extends EventEmitter {
|
|||
* @property {boolean} [sendVideoAsGif=false] - Send video as gif
|
||||
* @property {boolean} [sendMediaAsSticker=false] - Send media as a sticker
|
||||
* @property {boolean} [sendMediaAsDocument=false] - Send media as a document
|
||||
* @property {boolean} [isViewOnce=false] - Send photo/video as a view once message
|
||||
* @property {boolean} [parseVCards=true] - Automatically parse vCards and send them as contacts
|
||||
* @property {string} [caption] - Image or video caption
|
||||
* @property {string} [quotedMessageId] - Id of the message that is being quoted (or replied to)
|
||||
|
|
@ -779,10 +780,12 @@ class Client extends EventEmitter {
|
|||
|
||||
if (content instanceof MessageMedia) {
|
||||
internalOptions.attachment = content;
|
||||
internalOptions.isViewOnce = options.isViewOnce,
|
||||
content = '';
|
||||
} else if (options.media instanceof MessageMedia) {
|
||||
internalOptions.attachment = options.media;
|
||||
internalOptions.caption = content;
|
||||
internalOptions.isViewOnce = options.isViewOnce,
|
||||
content = '';
|
||||
} else if (content instanceof Location) {
|
||||
internalOptions.location = content;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ exports.LoadUtils = () => {
|
|||
attOptions.caption = options.caption;
|
||||
}
|
||||
content = options.sendMediaAsSticker ? undefined : attOptions.preview;
|
||||
attOptions.isViewOnce = options.isViewOnce;
|
||||
|
||||
delete options.attachment;
|
||||
delete options.sendMediaAsSticker;
|
||||
|
|
@ -232,8 +233,8 @@ exports.LoadUtils = () => {
|
|||
}
|
||||
|
||||
let listOptions = {};
|
||||
if(options.list){
|
||||
if(window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi'){
|
||||
if (options.list) {
|
||||
if (window.Store.Conn.platform === 'smba' || window.Store.Conn.platform === 'smbi') {
|
||||
throw '[LT01] Whatsapp business can\'t send this yet';
|
||||
}
|
||||
listOptions = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue