From 35781597d032fa7821e010e483c89f70ec51926c Mon Sep 17 00:00:00 2001 From: ckohen Date: Thu, 10 Jun 2021 00:41:01 -0700 Subject: [PATCH] fix(ApiMessage): only pass objects as options directly (#5793) * fix(ApiMessage): only pass objects as options directly * refactor: inline if with ternary --- src/structures/APIMessage.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/structures/APIMessage.js b/src/structures/APIMessage.js index 7f5116c9399e..d4f5f6564569 100644 --- a/src/structures/APIMessage.js +++ b/src/structures/APIMessage.js @@ -320,8 +320,10 @@ class APIMessage { * @returns {MessageOptions|WebhookMessageOptions} */ static create(target, options, extra = {}) { - if (typeof options === 'string') return new this(target, { content: options, ...extra }); - else return new this(target, { ...options, ...extra }); + return new this( + target, + typeof options !== 'object' || options === null ? { content: options, ...extra } : { ...options, ...extra }, + ); } }