finalised revive

This commit is contained in:
Amish Shah
2015-12-06 20:19:30 +00:00
parent d504406cfc
commit b59f2940e3
5 changed files with 13 additions and 8 deletions

View File

@@ -41,7 +41,7 @@ var Client = (function (_EventEmitter) {
_EventEmitter.call(this); _EventEmitter.call(this);
this.options = options || {}; this.options = options || {};
this.options.compress = options.compress || true; this.options.compress = options.compress || true;
this.options.autoRevive = options.autoRevive || false; this.options.revive = options.revive || false;
this.internal = new _InternalClient2["default"](this); this.internal = new _InternalClient2["default"](this);
} }

View File

@@ -184,7 +184,7 @@ var InternalClient = (function () {
this.leaveVoiceChannel(); this.leaveVoiceChannel();
if (this.client.options.autoRevive && !forced) { if (this.client.options.revive && !forced) {
this.setup(); this.setup();
this.login(this.email, this.password); this.login(this.email, this.password);
} }

View File

@@ -19,7 +19,7 @@ export default class Client extends EventEmitter {
super(); super();
this.options = options || {}; this.options = options || {};
this.options.compress = options.compress || true; this.options.compress = options.compress || true;
this.options.autoRevive = options.autoRevive || false; this.options.revive = options.revive || false;
this.internal = new InternalClient(this); this.internal = new InternalClient(this);
} }

View File

@@ -107,7 +107,7 @@ export default class InternalClient {
this.leaveVoiceChannel(); this.leaveVoiceChannel();
if(this.client.options.autoRevive && !forced){ if(this.client.options.revive && !forced){
this.setup(); this.setup();
this.login(this.email, this.password); this.login(this.email, this.password);
} }

View File

@@ -2,15 +2,16 @@
/* global process */ /* global process */
var Discord = require("../"); var Discord = require("../");
var client = new Discord.Client({autoRevive : true}); var client = new Discord.Client({revive : true});
var request = require("superagent"); var request = require("superagent");
client.on("ready", () => { client.on("ready", () => {
console.log("ready"); console.log("ready");
setTimeout(() => { setTimeout(() => {
client.internal.websocket.close(); if(client.internal.websocket)
}, 10000); client.internal.websocket.close();
}, 5000);
}); });
@@ -51,3 +52,7 @@ console.log("INIT");
client.on("debug", console.log) client.on("debug", console.log)
client.login(process.env["ds_email"], process.env["ds_password"]).catch(console.log); client.login(process.env["ds_email"], process.env["ds_password"]).catch(console.log);
var chan1, chan2;
var msg1, msg2;