mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
bug fixes
This commit is contained in:
@@ -79,6 +79,13 @@ const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
)
|
)
|
||||||
ev.emit('messages.update', updates)
|
ev.emit('messages.update', updates)
|
||||||
break
|
break
|
||||||
|
case 'mute':
|
||||||
|
if(attributes.mute === '0') {
|
||||||
|
ev.emit('chats.update', [{ jid, mute: null }])
|
||||||
|
} else {
|
||||||
|
ev.emit('chats.update', [{ jid, mute: attributes.mute }])
|
||||||
|
}
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
logger.warn({ node }, `received unrecognized chat update`)
|
logger.warn({ node }, `received unrecognized chat update`)
|
||||||
break
|
break
|
||||||
@@ -251,7 +258,7 @@ const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
...sock,
|
...sock,
|
||||||
sendChatsQuery,
|
sendChatsQuery,
|
||||||
fetchImageUrl,
|
fetchImageUrl,
|
||||||
chatRead: async(jid: string, count: number, fromMessage: WAMessageKey) => {
|
chatRead: async(fromMessage: WAMessageKey, count: number) => {
|
||||||
if(count < 0) {
|
if(count < 0) {
|
||||||
count = -2
|
count = -2
|
||||||
}
|
}
|
||||||
@@ -260,7 +267,7 @@ const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
new BinaryNode(
|
new BinaryNode(
|
||||||
'read',
|
'read',
|
||||||
{
|
{
|
||||||
jid,
|
jid: fromMessage.remoteJid,
|
||||||
count: count.toString(),
|
count: count.toString(),
|
||||||
index: fromMessage.id,
|
index: fromMessage.id,
|
||||||
owner: fromMessage.fromMe ? 'true' : 'false'
|
owner: fromMessage.fromMe ? 'true' : 'false'
|
||||||
@@ -269,7 +276,7 @@ const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
],
|
],
|
||||||
[ WAMetric.read, WAFlag.ignore ]
|
[ WAMetric.read, WAFlag.ignore ]
|
||||||
)
|
)
|
||||||
ev.emit ('chats.update', [{ jid, count: count < 0 ? -1 : 0 }])
|
ev.emit ('chats.update', [{ jid: fromMessage.remoteJid, count: count < 0 ? -1 : 0 }])
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Modify a given chat (archive, pin etc.)
|
* Modify a given chat (archive, pin etc.)
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ export const makeSocket = ({
|
|||||||
if(expect200 && Math.floor(responseStatusCode/100) !== 2) {
|
if(expect200 && Math.floor(responseStatusCode/100) !== 2) {
|
||||||
const message = STATUS_CODES[responseStatusCode] || 'unknown'
|
const message = STATUS_CODES[responseStatusCode] || 'unknown'
|
||||||
throw new Boom(
|
throw new Boom(
|
||||||
`Unexpected status in '${Object.values(json)[0] || 'query'}': ${message}(${responseStatusCode})`,
|
`Unexpected status in '${Array.isArray(json) ? json[0] : (json?.header || 'query')}': ${message}(${responseStatusCode})`,
|
||||||
{ data: { query: json, message }, statusCode: response.status }
|
{ data: { query: json, message }, statusCode: response.status }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -345,19 +345,16 @@ export const makeSocket = ({
|
|||||||
waitForMessage,
|
waitForMessage,
|
||||||
query,
|
query,
|
||||||
/** Generic function for action, set queries */
|
/** Generic function for action, set queries */
|
||||||
setQuery: async(nodes: BinaryNode[], binaryTag: WATag = [WAMetric.group, WAFlag.ignore], tag?: string) => (
|
setQuery: async(nodes: BinaryNode[], binaryTag: WATag = [WAMetric.group, WAFlag.ignore], tag?: string) => {
|
||||||
query({
|
const json = new BinaryNode('action', { epoch: epoch.toString(), type: 'set' }, nodes)
|
||||||
json: new BinaryNode(
|
return query({
|
||||||
'action',
|
json,
|
||||||
{ epoch: epoch.toString(), type: 'set' },
|
|
||||||
nodes
|
|
||||||
),
|
|
||||||
binaryTag,
|
binaryTag,
|
||||||
tag,
|
tag,
|
||||||
expect200: true,
|
expect200: true,
|
||||||
requiresPhoneConnection: true
|
requiresPhoneConnection: true
|
||||||
}) as Promise<{ status: number }>
|
}) as Promise<{ status: number }>
|
||||||
),
|
},
|
||||||
currentEpoch: () => epoch,
|
currentEpoch: () => epoch,
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user