From 592021df924344e44cdd38d39a6574c09fdbf7dd Mon Sep 17 00:00:00 2001 From: Ryan Munro Date: Thu, 13 Feb 2020 08:25:14 +1100 Subject: [PATCH] feat(Message): throw a TypeError if delete is passed a non-object (#3772) --- src/structures/Message.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index adc4ec834..a7b55560c 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -482,7 +482,9 @@ class Message extends Base { * .then(msg => console.log(`Deleted message from ${msg.author.username}`)) * .catch(console.error); */ - delete({ timeout = 0, reason } = {}) { + delete(options = {}) { + if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true); + const { timeout = 0, reason } = options; if (timeout <= 0) { return this.channel.messages.delete(this.id, reason).then(() => this); } else {