diff --git a/src/structures/Message.js b/src/structures/Message.js index da63b87..8702915 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -64,7 +64,7 @@ class Message extends Base { * ID for the Chat that this message was sent to, except if the message was sent by the current user. * @type {string} */ - this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from; + this.from = (typeof (data.from) === 'object' && data.from !== null) ? data.from._serialized : data.from; /** * ID for who this message is for. @@ -73,13 +73,13 @@ class Message extends Base { * If the message is sent by another user, it will be the ID for the current user. * @type {string} */ - this.to = typeof (data.to) === 'object' ? data.to._serialized : data.to; + this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to; /** * If the message was sent to a group, this field will contain the user that sent the message. * @type {string} */ - this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author; + this.author = (typeof (data.author) === 'object' && data.author !== null) ? data.author._serialized : data.author; /** * Indicates if the message was forwarded