mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(MessageManager): throw if delete param is not MessageResolvable (#4825)
This commit is contained in:
@@ -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,10 +121,10 @@ class MessageManager extends BaseManager {
|
||||
*/
|
||||
async delete(message, reason) {
|
||||
message = this.resolveID(message);
|
||||
if (message) {
|
||||
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) {
|
||||
if (!force) {
|
||||
|
||||
Reference in New Issue
Block a user