mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Merge pull request #451 from andresayac/master
proposal: detect desktop and fix device identification using message
This commit is contained in:
@@ -738,10 +738,7 @@ 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) => {
|
export const getDevice = (id: string) => /^3A/.test(id) ? 'ios' : /^3E/.test(id) ? 'web' : /^.{21}/.test(id) ? 'android' : /^.{18}/.test(id) ? 'desktop' : 'unknown'
|
||||||
const deviceType = id.length > 21 ? 'android' : id.substring(0, 2) === '3A' ? 'ios' : 'web'
|
|
||||||
return deviceType
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 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