From f7d0456a49bf22250440630809e04f76798e0195 Mon Sep 17 00:00:00 2001 From: alechkos <93551621+alechkos@users.noreply.github.com> Date: Mon, 2 Jun 2025 05:37:21 +0300 Subject: [PATCH] hotfix: fix window.WWebJS.getChatModel (#3573) --- index.d.ts | 2 +- src/Client.js | 2 ++ src/util/Injected/Utils.js | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index eccc59a..53a59c9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1261,7 +1261,7 @@ declare namespace WAWebJS { /** Sticker categories, if sendMediaAsSticker is true */ stickerCategories?: string[], /** Should the bot send a quoted message without the quoted message if it fails to get the quote? - * @default false (disabled) */ + * @default true (enabled) */ ignoreQuoteErrors?: boolean } diff --git a/src/Client.js b/src/Client.js index c841422..5f73f25 100644 --- a/src/Client.js +++ b/src/Client.js @@ -851,6 +851,7 @@ class Client extends EventEmitter { * @property {string} [stickerAuthor=undefined] - Sets the author of the sticker, (if sendMediaAsSticker is true). * @property {string} [stickerName=undefined] - Sets the name of the sticker, (if sendMediaAsSticker is true). * @property {string[]} [stickerCategories=undefined] - Sets the categories of the sticker, (if sendMediaAsSticker is true). Provide emoji char array, can be null. + * @property {boolean} [ignoreQuoteErrors = true] - Should the bot send a quoted message without the quoted message if it fails to get the quote? * @property {MessageMedia} [media] - Media to be sent * @property {any} [extra] - Extra options */ @@ -899,6 +900,7 @@ class Client extends EventEmitter { mentionedJidList: options.mentions || [], groupMentions: options.groupMentions, invokedBotWid: options.invokedBotWid, + ignoreQuoteErrors: options.ignoreQuoteErrors !== false, extraOptions: options.extra }; diff --git a/src/util/Injected/Utils.js b/src/util/Injected/Utils.js index e281c41..5ef3bbc 100644 --- a/src/util/Injected/Utils.js +++ b/src/util/Injected/Utils.js @@ -48,7 +48,7 @@ exports.LoadUtils = () => { let quotedMessage = window.Store.Msg.get(options.quotedMessageId); !quotedMessage && (quotedMessage = (await window.Store.Msg.getMessagesById([options.quotedMessageId]))?.messages?.[0]); - if (quotedMessage['messages'].length == 1) { + if (quotedMessage['messages']?.length == 1) { quotedMessage = quotedMessage['messages'][0]; const canReply = window.Store.ReplyUtils @@ -550,7 +550,7 @@ exports.LoadUtils = () => { model.isGroup = true; const chatWid = window.Store.WidFactory.createWid(chat.id._serialized); await window.Store.GroupMetadata.update(chatWid); - model.groupMetadata.participants._models + chat.groupMetadata.participants._models .filter(x => x.id._serialized.endsWith('@lid')) .forEach(x => { x.id = x.contact.phoneNumber; }); model.groupMetadata = chat.groupMetadata.serialize();