mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat(MessageStore): add remove() (#2468)
* MessageStore#remove() * typings
This commit is contained in:
@@ -82,6 +82,16 @@ class MessageStore extends DataStore {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a message, even if it's not cached.
|
||||
* @param {MessageResolvable} message The message to delete
|
||||
* @param {string} [reason] Reason for deleting this message, if it does not belong to the client user
|
||||
*/
|
||||
async remove(message, reason) {
|
||||
message = this.resolveID(message);
|
||||
if (message) await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
|
||||
}
|
||||
|
||||
async _fetchId(messageID, cache) {
|
||||
const existing = this.get(messageID);
|
||||
if (existing && !existing.partial) return existing;
|
||||
|
||||
Reference in New Issue
Block a user