mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
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:
@@ -727,7 +727,11 @@ export const extractMessageContent = (content: WAMessageContent | undefined | nu
|
|||||||
/**
|
/**
|
||||||
* Returns the device predicted by message ID
|
* 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 */
|
/** Upserts a receipt in the message */
|
||||||
export const updateMessageWithReceipt = (msg: Pick<WAMessage, 'userReceipt'>, receipt: MessageUserReceipt) => {
|
export const updateMessageWithReceipt = (msg: Pick<WAMessage, 'userReceipt'>, receipt: MessageUserReceipt) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user