mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
whatsapp web version (#1868)
* whatsapp web version * whatsapp web version * function for fetch latest whatsapp web version * whatsapp web version
This commit is contained in:
committed by
GitHub
parent
7968abb0db
commit
f13bd1fdab
@@ -254,6 +254,27 @@ export const fetchLatestBaileysVersion = async() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A utility that fetches the latest web version of whatsapp.
|
||||||
|
* Use to ensure your WA connection is always on the latest version
|
||||||
|
*/
|
||||||
|
export const fetchLatestWaWebVersion = async() => {
|
||||||
|
try {
|
||||||
|
const result = await axios.get('https://web.whatsapp.com/check-update?version=1&platform=web', { responseType: 'json' })
|
||||||
|
const version = result.data.currentVersion.split('.')
|
||||||
|
return {
|
||||||
|
version: [+version[0], +version[1], +version[2]] as WAVersion,
|
||||||
|
isLatest: true
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
return {
|
||||||
|
version: baileysVersion as WAVersion,
|
||||||
|
isLatest: false,
|
||||||
|
error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** unique message tag prefix for MD clients */
|
/** unique message tag prefix for MD clients */
|
||||||
export const generateMdTagPrefix = () => {
|
export const generateMdTagPrefix = () => {
|
||||||
const bytes = randomBytes(4)
|
const bytes = randomBytes(4)
|
||||||
|
|||||||
Reference in New Issue
Block a user