Skip to content

Commit 13d64e6

Browse files
authored
fix(MessageManager): throw if delete param is not MessageResolvable (#4825)
1 parent f83b3d7 commit 13d64e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/managers/MessageManager.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const BaseManager = require('./BaseManager');
4+
const { TypeError } = require('../errors');
45
const Message = require('../structures/Message');
56
const Collection = require('../util/Collection');
67
const LimitedCollection = require('../util/LimitedCollection');
@@ -120,9 +121,9 @@ class MessageManager extends BaseManager {
120121
*/
121122
async delete(message, reason) {
122123
message = this.resolveID(message);
123-
if (message) {
124-
await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
125-
}
124+
if (!message) throw new TypeError('INVALID_TYPE', 'message', 'MessageResolvable');
125+
126+
await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
126127
}
127128

128129
async _fetchId(messageID, cache, force) {

0 commit comments

Comments
 (0)