mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
add inviteCode
This commit is contained in:
@@ -222,7 +222,15 @@ const makeGroupsSocket = (config: SocketConfig) => {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
return metadata
|
return metadata
|
||||||
}
|
},
|
||||||
|
inviteCode: async(jid: string) => {
|
||||||
|
const response = await sock.query({
|
||||||
|
json: ['query', 'inviteCode', jid],
|
||||||
|
expect200: true,
|
||||||
|
requiresPhoneConnection: false
|
||||||
|
})
|
||||||
|
return response.code as string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,19 +117,19 @@ const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
if(message.message) {
|
if(message.message) {
|
||||||
chatUpdate.t = +toNumber(message.messageTimestamp)
|
chatUpdate.t = +toNumber(message.messageTimestamp)
|
||||||
}
|
// add to count if the message isn't from me & there exists a message
|
||||||
// add to count if the message isn't from me & there exists a message
|
if(!message.key.fromMe) {
|
||||||
if(!message.key.fromMe && message.message) {
|
chatUpdate.count = 1
|
||||||
chatUpdate.count = 1
|
const participant = whatsappID(message.participant || jid)
|
||||||
const participant = whatsappID(message.participant || jid)
|
|
||||||
|
|
||||||
ev.emit(
|
ev.emit(
|
||||||
'presence.update',
|
'presence.update',
|
||||||
{
|
{
|
||||||
jid,
|
jid,
|
||||||
presences: { [participant]: { lastKnownPresence: Presence.available } }
|
presences: { [participant]: { lastKnownPresence: Presence.available } }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ephemeralProtocolMsg = message.message?.ephemeralMessage?.message?.protocolMessage
|
const ephemeralProtocolMsg = message.message?.ephemeralMessage?.message?.protocolMessage
|
||||||
|
|||||||
Reference in New Issue
Block a user