mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Feat: Block messages from unknown numbers (#1071)
* Update Chat.ts * Update chats.ts * lint * lint * lint
This commit is contained in:
@@ -2,7 +2,7 @@ import { Boom } from '@hapi/boom'
|
||||
import NodeCache from '@cacheable/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, WAPrivacyGroupAddValue, 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, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types'
|
||||
import { LabelActionBody } from '../Types/Label'
|
||||
import { chatModificationToAppPatch, ChatMutationMap, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils'
|
||||
import { makeMutex } from '../Utils/make-mutex'
|
||||
@@ -95,6 +95,10 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
})
|
||||
}
|
||||
|
||||
const updateMessagesPrivacy = async(value: WAPrivacyMessagesValue) => {
|
||||
await privacyQuery('messages', value)
|
||||
}
|
||||
|
||||
const updateCallPrivacy = async(value: WAPrivacyCallValue) => {
|
||||
await privacyQuery('calladd', value)
|
||||
}
|
||||
@@ -993,6 +997,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
updateProfileName,
|
||||
updateBlockStatus,
|
||||
updateCallPrivacy,
|
||||
updateMessagesPrivacy,
|
||||
updateLastSeenPrivacy,
|
||||
updateOnlinePrivacy,
|
||||
updateProfilePicturePrivacy,
|
||||
|
||||
@@ -17,6 +17,8 @@ export type WAReadReceiptsValue = 'all' | 'none'
|
||||
|
||||
export type WAPrivacyCallValue = 'all' | 'known'
|
||||
|
||||
export type WAPrivacyMessagesValue = 'all' | 'contacts'
|
||||
|
||||
/** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
|
||||
export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user