feat(Message): throw a TypeError if delete is passed a non-object (#3772)

This commit is contained in:
Ryan Munro
2020-02-13 08:25:14 +11:00
committed by GitHub
parent 3f8ea38b3a
commit 592021df92

View File

@@ -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 {