From ffafc167fb667713229467d2ad62a9444fddc6e3 Mon Sep 17 00:00:00 2001 From: arthur simas Date: Wed, 14 Aug 2024 06:16:12 -0300 Subject: [PATCH] fix: remove 'none' from updateGroupsAddPrivacy (#966) * fix: remove 'none' from updateGroupsAddPrivacy * fix(fix/remove-none-groupadd): linting --------- Co-authored-by: Rajeh Taher --- README.md | 2 +- src/Socket/chats.ts | 4 ++-- src/Types/Chat.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4635a64..8fa7739 100644 --- a/README.md +++ b/README.md @@ -835,7 +835,7 @@ Of course, replace ``` xyz ``` with an actual ID. ``` - To update the Groups Add privacy ``` ts - const value = 'all' // 'contacts' | 'contact_blacklist' | 'none' + const value = 'all' // 'contacts' | 'contact_blacklist' await sock.updateGroupsAddPrivacy(value) ``` - To update the Default Disappearing Mode diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index bb315d0..7385d09 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -2,7 +2,7 @@ import { Boom } from '@hapi/boom' import NodeCache from 'node-cache' import { proto } from '../../WAProto' import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults' -import { ALL_WA_PATCH_NAMES, ChatModification, ChatMutation, LTHashState, MessageUpsertType, PresenceData, SocketConfig, WABusinessHoursConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPatchName, WAPresence, WAPrivacyCallValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types' +import { ALL_WA_PATCH_NAMES, ChatModification, ChatMutation, LTHashState, MessageUpsertType, PresenceData, SocketConfig, WABusinessHoursConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPatchName, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types' import { chatModificationToAppPatch, ChatMutationMap, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils' import { makeMutex } from '../Utils/make-mutex' import processMessage from '../Utils/process-message' @@ -117,7 +117,7 @@ export const makeChatsSocket = (config: SocketConfig) => { await privacyQuery('readreceipts', value) } - const updateGroupsAddPrivacy = async(value: WAPrivacyValue) => { + const updateGroupsAddPrivacy = async(value: WAPrivacyGroupAddValue) => { await privacyQuery('groupadd', value) } diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts index 2f7058f..09b2cc3 100644 --- a/src/Types/Chat.ts +++ b/src/Types/Chat.ts @@ -10,6 +10,8 @@ export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none' export type WAPrivacyOnlineValue = 'all' | 'match_last_seen' +export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist' + export type WAReadReceiptsValue = 'all' | 'none' export type WAPrivacyCallValue = 'all' | 'known'