Add client shard eval/client property fetching, and improve existing shard stuff

This commit is contained in:
Schuyler Cebulskie
2016-09-27 02:19:53 -04:00
parent c26fc49caf
commit e5a987e0ef
7 changed files with 177 additions and 71 deletions

View File

@@ -10,7 +10,7 @@ const WebSocketManager = require('./websocket/WebSocketManager');
const ActionsManager = require('./actions/ActionsManager');
const Collection = require('../util/Collection');
const Presence = require('../structures/Presence').Presence;
const ShardUtil = require('../sharding/ShardUtil');
const ShardClientUtil = require('../sharding/ShardClientUtil');
/**
* The starting point for making a Discord Bot.
@@ -90,7 +90,7 @@ class Client extends EventEmitter {
* The shard helpers for the client (only if the process was spawned as a child, such as from a ShardingManager)
* @type {?ShardUtil}
*/
this.shard = process.send ? ShardUtil.singleton(this) : null;
this.shard = process.send ? ShardClientUtil.singleton(this) : null;
if (this.shard) process.on('message', this.shard._handleMessage.bind(this.shard));
/**
@@ -339,6 +339,10 @@ class Client extends EventEmitter {
}
this.presences.set(id, new Presence(presence));
}
_eval(script) {
return eval(script);
}
}
module.exports = Client;