add guild sharding support (#393)

* add guild sharding support

* squash if statements
This commit is contained in:
Brian Tanner
2016-05-31 13:19:15 -04:00
committed by abalabahaha
parent a073010197
commit 00e3708e78
4 changed files with 30 additions and 6 deletions

View File

@@ -1430,8 +1430,7 @@ export default class InternalClient {
this.websocket = new WebSocket(url);
this.websocket.onopen = () => {
self.sendWS({
var data = {
op: 2,
d: {
token: self.token,
@@ -1446,7 +1445,13 @@ export default class InternalClient {
"$referring_domain": "discord.js"
}
}
});
};
if (self.client.options.shard) {
data.d.shard = self.client.options.shard;
}
self.sendWS(data);
};
this.websocket.onclose = (code) => {