mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added updateMessage
This commit is contained in:
@@ -148,6 +148,8 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
// def deleteMessage
|
||||
|
||||
Client.prototype.deleteMessage = function deleteMessage(msg) {
|
||||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (e) {} : arguments[2];
|
||||
@@ -169,6 +171,29 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
//def updateMessage
|
||||
|
||||
Client.prototype.updateMessage = function updateMessage(msg, content) {
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function (err, msg) {} : arguments[3];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
|
||||
self.internal.updateMessage(msg, content, options).then(function (msg) {
|
||||
callback(null, msg);
|
||||
resolve(msg);
|
||||
})["catch"](function (e) {
|
||||
callback(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return Client;
|
||||
})(EventEmitter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user