fix(MessageManager): throw if delete param is not MessageResolvable (#4825)

This commit is contained in:
monbrey 2020-09-26 07:46:06 +10:00 committed by GitHub
parent f83b3d7fc1
commit 13d64e6fa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
'use strict';
const BaseManager = require('./BaseManager');
const { TypeError } = require('../errors');
const Message = require('../structures/Message');
const Collection = require('../util/Collection');
const LimitedCollection = require('../util/LimitedCollection');
@ -120,9 +121,9 @@ class MessageManager extends BaseManager {
*/
async delete(message, reason) {
message = this.resolveID(message);
if (message) {
await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
}
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
}
async _fetchId(messageID, cache, force) {