mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
lint: 0 warnings left
This commit is contained in:
@@ -999,15 +999,13 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
)
|
||||
}
|
||||
|
||||
if(receivedPendingNotifications) {
|
||||
// if we don't have the app state key
|
||||
if(receivedPendingNotifications && // if we don't have the app state key
|
||||
// we keep buffering events until we finally have
|
||||
// the key and can sync the messages
|
||||
// todo scrutinize
|
||||
if(!authState.creds?.myAppStateKeyId) {
|
||||
ev.buffer()
|
||||
needToFlushWithAppStateSync = true
|
||||
}
|
||||
!authState.creds?.myAppStateKeyId) {
|
||||
ev.buffer()
|
||||
needToFlushWithAppStateSync = true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
break
|
||||
case 'membership_approval_mode':
|
||||
const approvalMode: any = getBinaryNodeChild(child, 'group_join')
|
||||
const approvalMode = getBinaryNodeChild(child, 'group_join')
|
||||
if(approvalMode) {
|
||||
msg.messageStubType = WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE
|
||||
msg.messageStubParameters = [ approvalMode.attrs.state ]
|
||||
@@ -574,8 +574,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
logger.debug({ participant, sendToAll }, 'forced new session for retry recp')
|
||||
|
||||
for(let i = 0; i < msgs.length;i++) {
|
||||
const msg = msgs[i]
|
||||
for(const [i, msg] of msgs.entries()) {
|
||||
if(msg) {
|
||||
updateSendMessageAgainCount(ids[i], participant)
|
||||
const msgRelayOpts: MessageRelayOptions = { messageId: ids[i] }
|
||||
@@ -761,10 +760,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
msg.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT, response]
|
||||
}
|
||||
|
||||
if(msg.message?.protocolMessage?.type === proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER) {
|
||||
if(node.attrs.sender_pn) {
|
||||
ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn })
|
||||
}
|
||||
if(msg.message?.protocolMessage?.type === proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER && node.attrs.sender_pn) {
|
||||
ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn })
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -851,7 +848,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
return sendPeerDataOperationMessage(pdoMessage)
|
||||
}
|
||||
|
||||
const requestPlaceholderResend = async(messageKey: WAMessageKey): Promise<'RESOLVED'| string | undefined> => {
|
||||
const requestPlaceholderResend = async(messageKey: WAMessageKey): Promise<string | undefined> => {
|
||||
if(!authState.creds.me?.id) {
|
||||
throw new Boom('Not authenticated')
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
const meJid = jidNormalizedUser(authState.creds.me.id)!
|
||||
const meJid = jidNormalizedUser(authState.creds.me.id)
|
||||
|
||||
const msgId = await relayMessage(meJid, protocolMessage, {
|
||||
additionalAttributes: {
|
||||
|
||||
@@ -76,7 +76,7 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
url.searchParams.append('ED', authState.creds.routingInfo.toString('base64url'))
|
||||
}
|
||||
|
||||
const ws = config.socket ? config.socket : new WebSocketClient(url, config)
|
||||
const ws = new WebSocketClient(url, config)
|
||||
|
||||
ws.connect()
|
||||
|
||||
@@ -327,11 +327,12 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
const l1 = frame.attrs || {}
|
||||
const l2 = Array.isArray(frame.content) ? frame.content[0]?.tag : ''
|
||||
|
||||
Object.keys(l1).forEach(key => {
|
||||
for(const key of Object.keys(l1)) {
|
||||
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]},${l2}`, frame) || anyTriggered
|
||||
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]}`, frame) || anyTriggered
|
||||
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}`, frame) || anyTriggered
|
||||
})
|
||||
}
|
||||
|
||||
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},,${l2}`, frame) || anyTriggered
|
||||
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0}`, frame) || anyTriggered
|
||||
|
||||
|
||||
Reference in New Issue
Block a user