add inviteCode

This commit is contained in:
Adhiraj Singh
2021-09-08 15:25:34 +05:30
parent c4a9f26e92
commit 7be1db3beb
2 changed files with 21 additions and 13 deletions

View File

@@ -222,7 +222,15 @@ const makeGroupsSocket = (config: SocketConfig) => {
))
}
return metadata
}
},
inviteCode: async(jid: string) => {
const response = await sock.query({
json: ['query', 'inviteCode', jid],
expect200: true,
requiresPhoneConnection: false
})
return response.code as string
}
}
}

View File

@@ -117,19 +117,19 @@ const makeMessagesSocket = (config: SocketConfig) => {
if(message.message) {
chatUpdate.t = +toNumber(message.messageTimestamp)
}
// add to count if the message isn't from me & there exists a message
if(!message.key.fromMe && message.message) {
chatUpdate.count = 1
const participant = whatsappID(message.participant || jid)
// add to count if the message isn't from me & there exists a message
if(!message.key.fromMe) {
chatUpdate.count = 1
const participant = whatsappID(message.participant || jid)
ev.emit(
'presence.update',
{
jid,
presences: { [participant]: { lastKnownPresence: Presence.available } }
}
)
ev.emit(
'presence.update',
{
jid,
presences: { [participant]: { lastKnownPresence: Presence.available } }
}
)
}
}
const ephemeralProtocolMsg = message.message?.ephemeralMessage?.message?.protocolMessage