mirror of
https://github.com/danbulant/discord.js
synced 2026-06-17 13:41:29 +00:00
fix(MessageManager): throw if delete param is not MessageResolvable (#4825)
This commit is contained in:
parent
f83b3d7fc1
commit
13d64e6fa6
1 changed files with 4 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue