hotfix: fix window.WWebJS.getChatModel (#3573)

This commit is contained in:
alechkos 2025-06-02 05:37:21 +03:00 • committed by GitHub
commit f7d0456a49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

2
index.d.ts vendored
View file

@ -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
}

View file

@ -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
};

View file

@ -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();