Bulk deletion of messages (#336) (#337)

This commit is contained in:
Nicholas Tay
2016-05-11 02:21:55 +10:00
committed by abalabahaha
parent d73ebcdfd4
commit 71db8555fe
4 changed files with 174 additions and 66 deletions

View File

@@ -408,6 +408,22 @@ var Client = (function (_EventEmitter) {
return this.internal.deleteMessage(message, options).then(dataCallback(callback), errorCallback(callback));
};
/**
* Bulk deletes messages (if the client has permission to)
* @param {Array<MessageResolvable>} message the message to delete
* @param {function(err: Error)} [callback] callback to the method
* @returns {Promise<null, Error>} Resolves with null if the deletion was successful, otherwise rejects with an Error.
* @example
* // deleting messages
* client.deleteMessages([message1, message2]);
*/
Client.prototype.deleteMessages = function deleteMessages(messages) {
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, {}*/{} : arguments[1];
return this.internal.deleteMessages(messages).then(dataCallback(callback), errorCallback(callback));
};
/**
* Edits a previously sent message (if the client has permission to)
* @param {MessageResolvable} message the message to edit