Added updateMessage

This commit is contained in:
hydrabolt
2015-10-31 23:23:48 +00:00
parent a333548c00
commit 4b4b7d6a47
8 changed files with 180 additions and 36 deletions

View File

@@ -129,7 +129,7 @@ class Client extends EventEmitter {
});
});
}
// def deleteMessage
deleteMessage(msg, options = {}, callback = function (e) { }) {
var self = this;
return new Promise((resolve, reject) => {
@@ -150,6 +150,27 @@ class Client extends EventEmitter {
});
}
//def updateMessage
updateMessage(msg, content, options = {}, callback = function(err, msg){}) {
var self = this;
return new Promise((resolve, reject) => {
if (typeof options === "function") {
// options is the callback
callback = options;
}
self.internal.updateMessage(msg, content, options)
.then(msg => {
callback(null, msg);
resolve(msg);
})
.catch(e => {
callback(e);
reject(e);
});
});
}
}
module.exports = Client;