start work with broadcast streams

This commit is contained in:
Amish Shah
2016-12-29 21:22:13 +00:00
parent e9af3f0a1f
commit 72a99f9582
6 changed files with 153 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ const ActionsManager = require('./actions/ActionsManager');
const Collection = require('../util/Collection');
const Presence = require('../structures/Presence').Presence;
const ShardClientUtil = require('../sharding/ShardClientUtil');
const VoiceBroadcast = require('./voice/VoiceBroadcast');
/**
* The starting point for making a Discord Bot.
@@ -136,6 +137,12 @@ class Client extends EventEmitter {
*/
this.readyAt = null;
/**
* An array of voice broadcasts
* @type {VoiceBroadcast[]}
*/
this.broadcasts = [];
/**
* The previous heartbeat pings of the websocket (most recent first, limited to three elements)
* @type {number[]}
@@ -219,6 +226,12 @@ class Client extends EventEmitter {
return typeof window !== 'undefined';
}
createVoiceBroadcast() {
const broadcast = new VoiceBroadcast(this);
this.broadcasts.push(broadcast);
return broadcast;
}
/**
* Logs the client in. If successful, resolves with the account's token. <warn>If you're making a bot, it's
* much better to use a bot account rather than a user account.