sendFile and fix deleteMessage

This commit is contained in:
hydrabolt
2015-11-01 00:16:58 +00:00
parent 53ef5df10d
commit b8aaa590b4
8 changed files with 123 additions and 36 deletions

View File

@@ -161,7 +161,7 @@ var Client = (function (_EventEmitter) {
callback = options;
}
self.internal.deleteMessage(msg).then(function () {
self.internal.deleteMessage(msg, options).then(function () {
callback();
resolve();
})["catch"](function (e) {
@@ -217,6 +217,24 @@ var Client = (function (_EventEmitter) {
});
};
// def sendFile
Client.prototype.sendFile = function sendFile(where, attachment) {
var name = arguments.length <= 2 || arguments[2] === undefined ? "image.png" : arguments[2];
var callback = arguments.length <= 3 || arguments[3] === undefined ? function (err, m) {} : arguments[3];
var self = this;
return new Promise(function (resolve, reject) {
self.internal.sendFile(where, attachment, name).then(function (m) {
callback(null, m);
resolve(m);
})["catch"](function (e) {
callback(e);
reject(e);
});
});
};
return Client;
})(EventEmitter);