User bot property

This commit is contained in:
abalabahaha
2016-03-19 22:11:11 -07:00
parent afdb93b3d6
commit 703ac05400
4 changed files with 26 additions and 20 deletions

View File

@@ -30,6 +30,7 @@ var User = (function (_Equality) {
this.discriminator = data.discriminator; this.discriminator = data.discriminator;
this.id = data.id; this.id = data.id;
this.avatar = data.avatar; this.avatar = data.avatar;
this.bot = data.bot;
this.status = data.status || "offline"; this.status = data.status || "offline";
this.game = data.game || null; this.game = data.game || null;
this.typing = { this.typing = {

View File

@@ -14,33 +14,33 @@ var nonce = new Buffer(24);
nonce.fill(0); nonce.fill(0);
var VoicePacket = function VoicePacket(data, sequence, time, ssrc, secret) { var VoicePacket = function VoicePacket(data, sequence, time, ssrc, secret) {
_classCallCheck(this, VoicePacket); _classCallCheck(this, VoicePacket);
var mac = secret ? 16 : 0; var mac = secret ? 16 : 0;
var packetLength = data.length + 12 + mac; var packetLength = data.length + 12 + mac;
var audioBuffer = data; var audioBuffer = data;
var returnBuffer = new Buffer(packetLength); var returnBuffer = new Buffer(packetLength);
returnBuffer.fill(0); returnBuffer.fill(0);
returnBuffer[0] = 0x80; returnBuffer[0] = 0x80;
returnBuffer[1] = 0x78; returnBuffer[1] = 0x78;
returnBuffer.writeUIntBE(sequence, 2, 2); returnBuffer.writeUIntBE(sequence, 2, 2);
returnBuffer.writeUIntBE(time, 4, 4); returnBuffer.writeUIntBE(time, 4, 4);
returnBuffer.writeUIntBE(ssrc, 8, 4); returnBuffer.writeUIntBE(ssrc, 8, 4);
if (secret) { if (secret) {
// copy first 12 bytes // copy first 12 bytes
returnBuffer.copy(nonce, 0, 0, 12); returnBuffer.copy(nonce, 0, 0, 12);
audioBuffer = _tweetnacl2["default"].secretbox(data, nonce, secret); audioBuffer = _tweetnacl2["default"].secretbox(data, nonce, secret);
} }
for (var i = 0; i < audioBuffer.length; i++) { for (var i = 0; i < audioBuffer.length; i++) {
returnBuffer[i + 12] = audioBuffer[i]; returnBuffer[i + 12] = audioBuffer[i];
} }
return returnBuffer; return returnBuffer;
}; };
exports["default"] = VoicePacket; exports["default"] = VoicePacket;

View File

@@ -8,6 +8,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
var Transform = require('stream').Transform; var Transform = require('stream').Transform;
/**
* @see https://github.com/reneraab/pcm-volume/blob/master/index.js Inspired by this script
*/
var Volume = (function (_Transform) { var Volume = (function (_Transform) {
_inherits(Volume, _Transform); _inherits(Volume, _Transform);

View File

@@ -12,6 +12,7 @@ export default class User extends Equality{
this.discriminator = data.discriminator; this.discriminator = data.discriminator;
this.id = data.id; this.id = data.id;
this.avatar = data.avatar; this.avatar = data.avatar;
this.bot = data.bot;
this.status = data.status || "offline"; this.status = data.status || "offline";
this.game = data.game || null; this.game = data.game || null;
this.typing = { this.typing = {