From 0a061f982c681a04e5f144e2656b65a1cd2a9c10 Mon Sep 17 00:00:00 2001 From: tuyuribr <45042245+tuyuribr@users.noreply.github.com> Date: Mon, 31 May 2021 22:03:23 -0300 Subject: [PATCH] feat: Add from which device the message was sent (#648) * Add from which device the message was sent. Use the message Id for fingerprint the device that was being use when the message was sent * To single quotes Co-authored-by: Pedro S. Lopez --- src/structures/Message.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index 918d55e..783050b 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -82,6 +82,12 @@ class Message extends Base { */ this.author = (typeof (data.author) === 'object' && data.author !== null) ? data.author._serialized : data.author; + /** + * String that represents from which device type the message was sent + * @type {string} + */ + this.deviceType = data.id.id.length > 21 ? 'android' : data.id.id.substring(0,2) =='3A' ? 'ios' : 'web'; + /** * Indicates if the message was forwarded * @type {boolean}