mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
partially working autorevive
This commit is contained in:
@@ -33,11 +33,15 @@ var Client = (function (_EventEmitter) {
|
||||
client.
|
||||
*/
|
||||
|
||||
function Client(options) {
|
||||
function Client() {
|
||||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
||||
|
||||
_classCallCheck(this, Client);
|
||||
|
||||
_EventEmitter.call(this);
|
||||
this.options = options || {};
|
||||
this.options.compress = options.compress || true;
|
||||
this.options.autoRevive = options.autoRevive || false;
|
||||
this.internal = new _InternalClient2["default"](this);
|
||||
}
|
||||
|
||||
@@ -60,6 +64,18 @@ var Client = (function (_EventEmitter) {
|
||||
return this.internal.logout().then(callback, errCB(callback));
|
||||
};
|
||||
|
||||
// def destroy
|
||||
|
||||
Client.prototype.destroy = function destroy() {
|
||||
var _this = this;
|
||||
|
||||
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err*/{} : arguments[0];
|
||||
|
||||
this.internal.logout().then(function () {
|
||||
_this.internal.disconnected(true);
|
||||
});
|
||||
};
|
||||
|
||||
// def sendMessage
|
||||
|
||||
Client.prototype.sendMessage = function sendMessage(where, content) {
|
||||
@@ -551,7 +567,7 @@ var Client = (function (_EventEmitter) {
|
||||
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
||||
var toSend = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
|
||||
|
||||
var _this = this;
|
||||
var _this2 = this;
|
||||
|
||||
var options = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
|
||||
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*e, newMsg*/{} : arguments[3];
|
||||
@@ -585,7 +601,7 @@ var Client = (function (_EventEmitter) {
|
||||
}
|
||||
// (msg) promise
|
||||
return ret.then(function () {
|
||||
return _this.internal.awaitResponse(msg);
|
||||
return _this2.internal.awaitResponse(msg);
|
||||
}).then(function (newMsg) {
|
||||
callback(null, newMsg);
|
||||
return newMsg;
|
||||
|
||||
Reference in New Issue
Block a user