Fix sendFile content

This commit is contained in:
abalabahaha
2016-04-15 18:16:57 -07:00
parent d0f2029fa6
commit 864126976f
4 changed files with 91 additions and 70 deletions

View File

@@ -537,16 +537,21 @@ var Client = (function (_EventEmitter) {
* .catch(err => console.log("couldn't send file!"));
*/
Client.prototype.sendFile = function sendFile(destination, attachment, name) {
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, m*/{} : arguments[3];
Client.prototype.sendFile = function sendFile(destination, attachment, name, content) {
var callback = arguments.length <= 4 || arguments[4] === undefined ? function () /*err, m*/{} : arguments[4];
if (typeof content === "function") {
// content is the callback
callback = content;
content = undefined; // Will get resolved into original filename in internal
}
if (typeof name === "function") {
// name is the callback
callback = name;
name = undefined; // Will get resolved into original filename in internal
}
return this.internal.sendFile(destination, attachment, name).then(dataCallback(callback), errorCallback(callback));
return this.internal.sendFile(destination, attachment, name, content).then(dataCallback(callback), errorCallback(callback));
};
/**