mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Fixed awaiting
This commit is contained in:
@@ -804,6 +804,25 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
// def awaitResponse
|
||||
|
||||
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
||||
var _this = this;
|
||||
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function (e, newMsg) {} : arguments[1];
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
_this.internal.awaitResponse(msg).then(function (newMsg) {
|
||||
resolve(newMsg);
|
||||
callback(null, newMsg);
|
||||
})["catch"](function (e) {
|
||||
callback(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Client.prototype.setStatusIdle = function setStatusIdle() {
|
||||
this.setStatus("idle");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user