From a121ac018170d1d56a79cdc2e361b7ba752faaa7 Mon Sep 17 00:00:00 2001 From: icleitoncosta Date: Wed, 27 Nov 2024 12:49:30 -0300 Subject: [PATCH] fix: Fixed send message to newsletter (close #2528) --- src/chat/patch.ts | 1 + src/whatsapp/functions/contactFunctions.ts | 7 +++++++ src/whatsapp/misc/Wid.ts | 2 ++ src/whatsapp/models/ContactModel.ts | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/src/chat/patch.ts b/src/chat/patch.ts index 77149ca6ce..38ddbe3d27 100644 --- a/src/chat/patch.ts +++ b/src/chat/patch.ts @@ -109,6 +109,7 @@ function applyPatchModel() { isUser: functions.getIsUser, isPSA: functions.getIsPSA, isGroup: functions.getIsGroup, + isNewsletter: functions.getIsNewsletter, previewMessage: functions.getPreviewMessage, showChangeNumberNotification: functions.getShowChangeNumberNotification, hasUnread: functions.getHasUnread, diff --git a/src/whatsapp/functions/contactFunctions.ts b/src/whatsapp/functions/contactFunctions.ts index 8fe1f4c203..2461e6c425 100644 --- a/src/whatsapp/functions/contactFunctions.ts +++ b/src/whatsapp/functions/contactFunctions.ts @@ -73,6 +73,11 @@ export declare function getIsGroup(contact: ContactModel): any; */ export declare function getIsBroadcast(contact: ContactModel): any; +/** + * @whatsapp 660666 >= 2.2327.4 + */ +export declare function getIsNewsletter(contact: ContactModel): any; + /** * @whatsapp 660666 >= 2.2327.4 */ @@ -152,6 +157,7 @@ exportModule( getIsUser: 'getIsUser', getIsGroup: 'getIsGroup', getIsBroadcast: 'getIsBroadcast', + getIsNewsletter: 'getIsNewsletter', getIsPSA: 'getIsPSA', getIsIAS: 'getIsIAS', getIsSupportAccount: 'getIsSupportAccount', @@ -178,6 +184,7 @@ injectFallbackModule('getIsMyContact', { getIsMe: (contact: ContactModel) => contact.isMe, getIsUser: (contact: ContactModel) => contact.isUser, getIsGroup: (contact: ContactModel) => contact.isGroup, + getIsNewsletter: (contact: ContactModel) => contact.isNewsletter, getIsBroadcast: (contact: ContactModel) => contact.isBroadcast, getIsPSA: (contact: ContactModel) => contact.isPSA, getIsIAS: (contact: ContactModel) => contact.isIAS, diff --git a/src/whatsapp/misc/Wid.ts b/src/whatsapp/misc/Wid.ts index 0686a97b17..018964d795 100644 --- a/src/whatsapp/misc/Wid.ts +++ b/src/whatsapp/misc/Wid.ts @@ -37,6 +37,8 @@ export declare class Wid { getSignalAddress(): string; + isNewsletter(): boolean; + isBot(): boolean; isBroadcast(): boolean; diff --git a/src/whatsapp/models/ContactModel.ts b/src/whatsapp/models/ContactModel.ts index da29948da7..310fbcc75b 100644 --- a/src/whatsapp/models/ContactModel.ts +++ b/src/whatsapp/models/ContactModel.ts @@ -139,6 +139,11 @@ interface Derived { * @deprecated */ isBroadcast: boolean; + /** + * Deprecated in favor of getIsBroadcast + * @deprecated + */ + isNewsletter: boolean; /** * Deprecated in favor of getIsPSA * @deprecated