feat: add Id support for desktop (#1240)

* feat: add Id support for desktop

This commit adjusts the ID length check for desktop, fixing the issue where some desktop IDs were incorrectly classified as "unknown."

Baileys stopped identifying if a message was from WA Desktop (Based on my observations last Year).

This adjustment addresses this issue.

* redundancy removed

* fix: linting
This commit is contained in:
AstroX11
2025-02-24 02:24:44 +01:00
committed by GitHub
parent e254718488
commit 89b28a438b

View File

@@ -727,7 +727,11 @@ export const extractMessageContent = (content: WAMessageContent | undefined | nu
/**
* Returns the device predicted by message ID
*/
export const getDevice = (id: string) => /^3A.{18}$/.test(id) ? 'ios' : /^3E.{20}$/.test(id) ? 'web' : /^(.{21}|.{32})$/.test(id) ? 'android' : /^.{18}$/.test(id) ? 'desktop' : 'unknown'
export const getDevice = (id: string) => /^3A.{18}$/.test(id) ? 'ios' :
/^3E.{20}$/.test(id) ? 'web' :
/^(.{21}|.{32})$/.test(id) ? 'android' :
/^(3F|.{18}$)/.test(id) ? 'desktop' :
'unknown'
/** Upserts a receipt in the message */
export const updateMessageWithReceipt = (msg: Pick<WAMessage, 'userReceipt'>, receipt: MessageUserReceipt) => {