diff --git a/src/Client.js b/src/Client.js index d59bac6..d5eb7b7 100644 --- a/src/Client.js +++ b/src/Client.js @@ -742,6 +742,10 @@ class Client extends EventEmitter { * @returns {Promise} Message that was just sent */ async sendMessage(chatId, content, options = {}) { + if (options.mentions && options.mentions.some(possiblyContact => possiblyContact instanceof Contact)) { + console.warn('Mentions with an array of Contact are now deprecated. See more at https://github.com/pedroslopez/whatsapp-web.js/pull/2166.'); + options.mentions = options.mentions.map(a => a.id._serialized); + } let internalOptions = { linkPreview: options.linkPreview === false ? undefined : true, sendAudioAsVoice: options.sendAudioAsVoice, @@ -751,7 +755,7 @@ class Client extends EventEmitter { caption: options.caption, quotedMessageId: options.quotedMessageId, parseVCards: options.parseVCards === false ? false : true, - mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : [], + mentionedJidList: Array.isArray(options.mentions) ? options.mentions : [], extraOptions: options.extra };