mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 09:13:22 +00:00
feat(Message): throw a TypeError if delete is passed a non-object (#3772)
This commit is contained in:
parent
3f8ea38b3a
commit
592021df92
1 changed files with 3 additions and 1 deletions
|
|
@ -482,7 +482,9 @@ class Message extends Base {
|
||||||
* .then(msg => console.log(`Deleted message from ${msg.author.username}`))
|
* .then(msg => console.log(`Deleted message from ${msg.author.username}`))
|
||||||
* .catch(console.error);
|
* .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) {
|
if (timeout <= 0) {
|
||||||
return this.channel.messages.delete(this.id, reason).then(() => this);
|
return this.channel.messages.delete(this.id, reason).then(() => this);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue