mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
Fixing conflicts
This commit is contained in:
@@ -64,7 +64,7 @@ Plays a file to the voice channel. The file can be in practically any format; if
|
|||||||
In addition to a file path local to your computer, it can also accept a URL, however this is not recommended as the entire content of the URL will be read before any playback starts.
|
In addition to a file path local to your computer, it can also accept a URL, however this is not recommended as the entire content of the URL will be read before any playback starts.
|
||||||
This can cause delays from seconds to minutes - you can use `playRawStream` with a Stream obtained from the URL instead.
|
This can cause delays from seconds to minutes - you can use `playRawStream` with a Stream obtained from the URL instead.
|
||||||
|
|
||||||
The `options` object can be used to control playback properties, currently, it only allows setting the volume using the `volume` property, which can be in any of the following formats:
|
The `options` object can be used to control playback properties, currently, it currently allows setting the seek (in seconds) using the `seek` property, and the volume using the `volume` property, which can be in any of the following formats:
|
||||||
|
|
||||||
- A number representing the linear change in volume; 1 is equal to no change, 0 is completely silent, 0.5 is half the regular volume and 2 is double the regular volume.
|
- A number representing the linear change in volume; 1 is equal to no change, 0 is completely silent, 0.5 is half the regular volume and 2 is double the regular volume.
|
||||||
- A string representing the linear change in volume, if this is more convenient for you.
|
- A string representing the linear change in volume, if this is more convenient for you.
|
||||||
|
|||||||
@@ -1147,7 +1147,7 @@ var InternalClient = (function () {
|
|||||||
//def updateDetails
|
//def updateDetails
|
||||||
|
|
||||||
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
||||||
if (!this.email) {
|
if (!this.email && !data.email) {
|
||||||
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
||||||
}
|
}
|
||||||
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
|
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
|
||||||
@@ -1287,6 +1287,7 @@ var InternalClient = (function () {
|
|||||||
token: self.token,
|
token: self.token,
|
||||||
v: 3,
|
v: 3,
|
||||||
compress: self.client.options.compress,
|
compress: self.client.options.compress,
|
||||||
|
large_threshold: 250,
|
||||||
properties: {
|
properties: {
|
||||||
"$os": "discord.js",
|
"$os": "discord.js",
|
||||||
"$browser": "discord.js",
|
"$browser": "discord.js",
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ var Role = (function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Role.prototype.colorAsHex = function colorAsHex() {
|
Role.prototype.colorAsHex = function colorAsHex() {
|
||||||
var val = this.color.toString();
|
var val = this.color.toString(16);
|
||||||
while (val.length < 6) {
|
while (val.length < 6) {
|
||||||
val = "0" + val;
|
val = "0" + val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ var AudioEncoder = (function () {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
_this.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
||||||
|
|
||||||
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-loglevel', '0', '-i', '-', '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
var enc = _child_process2["default"].spawn(_this.getCommand(), ['-loglevel', '0', '-i', '-', '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||||
|
|
||||||
stream.pipe(enc.stdin);
|
stream.pipe(enc.stdin);
|
||||||
enc.stdout.pipe(_this.volume);
|
enc.stdout.pipe(_this.volume);
|
||||||
@@ -117,7 +117,7 @@ var AudioEncoder = (function () {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
_this2.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
_this2.volume = new _VolumeTransformer2["default"](options.volume || 1);
|
||||||
|
|
||||||
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-loglevel', '0', '-i', file, '-f', 's16le', '-ar', '48000', '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
var enc = _child_process2["default"].spawn(_this2.getCommand(), ['-loglevel', '0', '-i', file, '-f', 's16le', '-ar', '48000', '-ss', options.seek || 0, '-ac', 2, 'pipe:1'], { stdio: ['pipe', 'pipe', 'ignore'] });
|
||||||
|
|
||||||
enc.stdout.pipe(_this2.volume);
|
enc.stdout.pipe(_this2.volume);
|
||||||
|
|
||||||
|
|||||||
@@ -5,24 +5,24 @@ exports.__esModule = true;
|
|||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
|
||||||
var VoicePacket = function VoicePacket(data, sequence, time, ssrc) {
|
var VoicePacket = function VoicePacket(data, sequence, time, ssrc) {
|
||||||
_classCallCheck(this, VoicePacket);
|
_classCallCheck(this, VoicePacket);
|
||||||
|
|
||||||
var audioBuffer = data,
|
var audioBuffer = data,
|
||||||
returnBuffer = new Buffer(audioBuffer.length + 12);
|
returnBuffer = new Buffer(audioBuffer.length + 12);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
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;
|
||||||
|
|||||||
@@ -969,7 +969,7 @@ export default class InternalClient {
|
|||||||
|
|
||||||
//def updateDetails
|
//def updateDetails
|
||||||
updateDetails(data) {
|
updateDetails(data) {
|
||||||
if(!this.email) {
|
if(!this.email && !data.email) {
|
||||||
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
||||||
}
|
}
|
||||||
return this.apiRequest("patch", Endpoints.ME, true, {
|
return this.apiRequest("patch", Endpoints.ME, true, {
|
||||||
@@ -1086,6 +1086,7 @@ export default class InternalClient {
|
|||||||
token: self.token,
|
token: self.token,
|
||||||
v: 3,
|
v: 3,
|
||||||
compress: self.client.options.compress,
|
compress: self.client.options.compress,
|
||||||
|
large_threshold : 250,
|
||||||
properties: {
|
properties: {
|
||||||
"$os": "discord.js",
|
"$os": "discord.js",
|
||||||
"$browser": "discord.js",
|
"$browser": "discord.js",
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export default class Role {
|
|||||||
}
|
}
|
||||||
|
|
||||||
colorAsHex(){
|
colorAsHex(){
|
||||||
var val = this.color.toString();
|
var val = this.color.toString(16);
|
||||||
while(val.length < 6){
|
while(val.length < 6){
|
||||||
val = "0" + val;
|
val = "0" + val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export default class AudioEncoder {
|
|||||||
'-i', '-',
|
'-i', '-',
|
||||||
'-f', 's16le',
|
'-f', 's16le',
|
||||||
'-ar', '48000',
|
'-ar', '48000',
|
||||||
|
'-ss', (options.seek || 0),
|
||||||
'-ac', 2,
|
'-ac', 2,
|
||||||
'pipe:1'
|
'pipe:1'
|
||||||
], {stdio: ['pipe', 'pipe', 'ignore']});
|
], {stdio: ['pipe', 'pipe', 'ignore']});
|
||||||
@@ -102,6 +103,7 @@ export default class AudioEncoder {
|
|||||||
'-i', file,
|
'-i', file,
|
||||||
'-f', 's16le',
|
'-f', 's16le',
|
||||||
'-ar', '48000',
|
'-ar', '48000',
|
||||||
|
'-ss', (options.seek || 0),
|
||||||
'-ac', 2,
|
'-ac', 2,
|
||||||
'pipe:1'
|
'pipe:1'
|
||||||
], {stdio: ['pipe', 'pipe', 'ignore']});
|
], {stdio: ['pipe', 'pipe', 'ignore']});
|
||||||
|
|||||||
Reference in New Issue
Block a user