Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a745f2167 | |||
| a1def8c2c0 |
+11
-3
@@ -230,14 +230,22 @@ export const bindWaitForConnectionUpdate = (ev: BaileysEventEmitter) => bindWait
|
|||||||
* utility that fetches latest baileys version from the master branch.
|
* utility that fetches latest baileys version from the master branch.
|
||||||
* Use to ensure your WA connection is always on the latest version
|
* Use to ensure your WA connection is always on the latest version
|
||||||
*/
|
*/
|
||||||
export const fetchLatestBaileysVersion = async (options: RequestInit = {}) => {
|
export const fetchLatestBaileysVersion = async (options: RequestInit & { timeout?: number } = {}) => {
|
||||||
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts'
|
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts'
|
||||||
try {
|
try {
|
||||||
const response = await fetch(URL, {
|
const controller = new AbortController()
|
||||||
|
const timeout = setTimeout(() => controller.abort(), options.timeout ?? 5000)
|
||||||
|
let response: Response
|
||||||
|
try {
|
||||||
|
response = await fetch(URL, {
|
||||||
dispatcher: options.dispatcher,
|
dispatcher: options.dispatcher,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: options.headers
|
headers: options.headers,
|
||||||
|
signal: controller.signal
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
clearTimeout(timeout)
|
||||||
|
}
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Boom(`Failed to fetch latest Baileys version: ${response.statusText}`, { statusCode: response.status })
|
throw new Boom(`Failed to fetch latest Baileys version: ${response.statusText}`, { statusCode: response.status })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,14 +113,6 @@ export const cleanMessage = (message: WAMessage, meId: string, meLid: string) =>
|
|||||||
msgKey.remoteJid = message.key.remoteJid
|
msgKey.remoteJid = message.key.remoteJid
|
||||||
// set participant of the message
|
// set participant of the message
|
||||||
msgKey.participant = msgKey.participant || message.key.participant
|
msgKey.participant = msgKey.participant || message.key.participant
|
||||||
} else {
|
|
||||||
// fromMe reactions/polls: normalise remoteJid to match the chat JID
|
|
||||||
// ensures DM reaction keys are consistent with group behavior
|
|
||||||
msgKey.remoteJid = message.key.remoteJid
|
|
||||||
// in groups, normalise participant for own messages too
|
|
||||||
if (message.key.participant) {
|
|
||||||
msgKey.participant = msgKey.participant || message.key.participant
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user