Skip to content

Commit

Permalink
fix(ApiMessage): only pass objects as options directly (#5793)
Browse files Browse the repository at this point in the history
* fix(ApiMessage): only pass objects as options directly

* refactor: inline if with ternary
  • Loading branch information
ckohen committed Jun 10, 2021
1 parent 35c2225 commit 3578159
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/structures/APIMessage.js
Expand Up @@ -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 },
);
}
}

Expand Down

0 comments on commit 3578159

Please sign in to comment.