From 1200abd9c82810d7fe57c8eccd4f82ed8fcbe702 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Sat, 6 Sep 2025 12:19:33 +0300 Subject: [PATCH] refactor: remove wwebjs patch --- src/utils.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/utils.js b/src/utils.js index bc16f86..3833c8a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -144,32 +144,6 @@ const patchWWebLibrary = async (client) => { filteredChats.map(chat => window.WWebJS.getChatModel(chat)) ) } - - // hotfix for https://github.com/pedroslopez/whatsapp-web.js/pull/3703 - window.Store.FindOrCreateChat = window.require('WAWebFindChatAction') - window.WWebJS.getChat = async (chatId, { getAsModel = true } = {}) => { - const isChannel = /@\w*newsletter\b/.test(chatId) - const chatWid = window.Store.WidFactory.createWid(chatId) - let chat - - if (isChannel) { - try { - chat = window.Store.NewsletterCollection.get(chatId) - if (!chat) { - await window.Store.ChannelUtils.loadNewsletterPreviewChat(chatId) - chat = await window.Store.NewsletterCollection.find(chatWid) - } - } catch (err) { - chat = null - } - } else { - chat = window.Store.Chat.get(chatWid) || (await window.Store.FindOrCreateChat.findOrCreateLatestChat(chatWid))?.chat - } - - return getAsModel && chat - ? await window.WWebJS.getChatModel(chat, { isChannel }) - : chat - } }) }