discord-player
Advanced tools
Comparing version 5.1.0-dev.1635854838.a0badb8 to 5.1.0-dev.1636095464.54bb4b0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = exports.Util = exports.StreamDispatcher = exports.VoiceUtils = exports.Track = exports.Queue = exports.QueryResolver = exports.ErrorStatusCode = exports.PlayerError = exports.Player = exports.Playlist = exports.ExtractorModel = exports.AudioFilters = void 0; | ||
const tslib_1 = require("tslib"); | ||
var AudioFilters_1 = require("./utils/AudioFilters"); | ||
@@ -37,4 +28,4 @@ Object.defineProperty(exports, "AudioFilters", { enumerable: true, get: function () { return AudioFilters_1.AudioFilters; } }); | ||
Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return Util_1.Util; } }); | ||
__exportStar(require("./types/types"), exports); | ||
(0, tslib_1.__exportStar)(require("./types/types"), exports); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
exports.version = require(`${__dirname}/../package.json`).version; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Player = void 0; | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
@@ -21,7 +10,7 @@ const tiny_typed_emitter_1 = require("tiny-typed-emitter"); | ||
const types_1 = require("./types/types"); | ||
const Track_1 = __importDefault(require("./Structures/Track")); | ||
const Track_1 = (0, tslib_1.__importDefault)(require("./Structures/Track")); | ||
const QueryResolver_1 = require("./utils/QueryResolver"); | ||
const youtube_sr_1 = __importDefault(require("youtube-sr")); | ||
const youtube_sr_1 = (0, tslib_1.__importDefault)(require("youtube-sr")); | ||
const Util_1 = require("./utils/Util"); | ||
const spotify_url_info_1 = __importDefault(require("spotify-url-info")); | ||
const spotify_url_info_1 = (0, tslib_1.__importDefault)(require("spotify-url-info")); | ||
const PlayerError_1 = require("./Structures/PlayerError"); | ||
@@ -85,54 +74,72 @@ const ytdl_core_1 = require("ytdl-core"); | ||
return; | ||
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId && newState.member.id === newState.guild.me.id) { | ||
if (queue === null || queue === void 0 ? void 0 : queue.connection) | ||
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId) { | ||
if ((queue === null || queue === void 0 ? void 0 : queue.connection) && newState.member.id === newState.guild.me.id) | ||
queue.connection.channel = newState.channel; | ||
} | ||
if (!oldState.channelId && newState.channelId && newState.member.id === newState.guild.me.id) { | ||
if (newState.serverMute || !newState.serverMute) { | ||
queue.setPaused(newState.serverMute); | ||
if (newState.member.id === newState.guild.me.id || (newState.member.id !== newState.guild.me.id && oldState.channelId === queue.connection.channel.id)) { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
const timeout = setTimeout(() => { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
if (!this.queues.has(queue.guild.id)) | ||
return; | ||
if (queue.options.leaveOnEmpty) | ||
queue.destroy(); | ||
this.emit("channelEmpty", queue); | ||
}, queue.options.leaveOnEmptyCooldown || 0).unref(); | ||
queue._cooldownsTimeout.set(`empty_${oldState.guild.id}`, timeout); | ||
} | ||
else if (newState.suppress || !newState.suppress) { | ||
if (newState.suppress) | ||
newState.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); | ||
queue.setPaused(newState.suppress); | ||
if (!oldState.channelId && newState.channelId && newState.member.id === newState.guild.me.id) { | ||
if (newState.serverMute || !newState.serverMute) { | ||
queue.setPaused(newState.serverMute); | ||
} | ||
else if (newState.suppress || !newState.suppress) { | ||
if (newState.suppress) | ||
newState.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); | ||
queue.setPaused(newState.suppress); | ||
} | ||
} | ||
} | ||
if (oldState.channelId === newState.channelId && oldState.member.id === newState.guild.me.id) { | ||
if (oldState.serverMute !== newState.serverMute) { | ||
queue.setPaused(newState.serverMute); | ||
if (oldState.channelId === newState.channelId && oldState.member.id === newState.guild.me.id) { | ||
if (oldState.serverMute !== newState.serverMute) { | ||
queue.setPaused(newState.serverMute); | ||
} | ||
else if (oldState.suppress !== newState.suppress) { | ||
if (newState.suppress) | ||
newState.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); | ||
queue.setPaused(newState.suppress); | ||
} | ||
} | ||
else if (oldState.suppress !== newState.suppress) { | ||
if (newState.suppress) | ||
newState.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); | ||
queue.setPaused(newState.suppress); | ||
if (oldState.member.id === this.client.user.id && !newState.channelId) { | ||
queue.destroy(); | ||
return void this.emit("botDisconnect", queue); | ||
} | ||
} | ||
if (oldState.member.id === this.client.user.id && !newState.channelId) { | ||
queue.destroy(); | ||
return void this.emit("botDisconnect", queue); | ||
} | ||
if (!queue.connection || !queue.connection.channel) | ||
return; | ||
if (!oldState.channelId || newState.channelId) { | ||
const emptyTimeout = queue._cooldownsTimeout.get(`empty_${oldState.guild.id}`); | ||
const channelEmpty = Util_1.Util.isVoiceEmpty(queue.connection.channel); | ||
if (!channelEmpty && emptyTimeout) { | ||
clearTimeout(emptyTimeout); | ||
queue._cooldownsTimeout.delete(`empty_${oldState.guild.id}`); | ||
if (!queue.connection || !queue.connection.channel) | ||
return; | ||
if (!oldState.channelId || newState.channelId) { | ||
const emptyTimeout = queue._cooldownsTimeout.get(`empty_${oldState.guild.id}`); | ||
const channelEmpty = Util_1.Util.isVoiceEmpty(queue.connection.channel); | ||
if (newState.channelId === queue.connection.channel.id) { | ||
if (!channelEmpty && emptyTimeout) { | ||
clearTimeout(emptyTimeout); | ||
queue._cooldownsTimeout.delete(`empty_${oldState.guild.id}`); | ||
} | ||
} | ||
} | ||
else { | ||
if (oldState.channelId === queue.connection.channel.id) { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
const timeout = setTimeout(() => { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
if (!this.queues.has(queue.guild.id)) | ||
return; | ||
if (queue.options.leaveOnEmpty) | ||
queue.destroy(); | ||
this.emit("channelEmpty", queue); | ||
}, queue.options.leaveOnEmptyCooldown || 0).unref(); | ||
queue._cooldownsTimeout.set(`empty_${oldState.guild.id}`, timeout); | ||
} | ||
} | ||
} | ||
else { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
const timeout = setTimeout(() => { | ||
if (!Util_1.Util.isVoiceEmpty(queue.connection.channel)) | ||
return; | ||
if (!this.queues.has(queue.guild.id)) | ||
return; | ||
if (queue.options.leaveOnEmpty) | ||
queue.destroy(); | ||
this.emit("channelEmpty", queue); | ||
}, queue.options.leaveOnEmptyCooldown || 0).unref(); | ||
queue._cooldownsTimeout.set(`empty_${oldState.guild.id}`, timeout); | ||
} | ||
} | ||
@@ -201,3 +208,3 @@ /** | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if (query instanceof Track_1.default) | ||
@@ -230,3 +237,3 @@ return { playlist: null, tracks: [query] }; | ||
case types_1.QueryType.YOUTUBE_VIDEO: { | ||
const info = yield (0, ytdl_core_1.getInfo)(query).catch(Util_1.Util.noop); | ||
const info = yield (0, ytdl_core_1.getInfo)(query, this.options.ytdlOptions).catch(Util_1.Util.noop); | ||
if (!info) | ||
@@ -233,0 +240,0 @@ return { playlist: null, tracks: [] }; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ExtractorModel = void 0; | ||
const tslib_1 = require("tslib"); | ||
class ExtractorModel { | ||
@@ -41,3 +33,3 @@ /** | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const data = yield this._raw.getInfo(query); | ||
@@ -44,0 +36,0 @@ if (!data) |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var _Queue_instances, _Queue_lastVolume, _Queue_destroyed, _Queue_watchDestroyed, _Queue_getBufferingTimeout; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Queue = void 0; | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
const Track_1 = __importDefault(require("./Track")); | ||
const Track_1 = (0, tslib_1.__importDefault)(require("./Track")); | ||
const types_1 = require("../types/types"); | ||
const discord_ytdl_core_1 = __importDefault(require("discord-ytdl-core")); | ||
const discord_ytdl_core_1 = (0, tslib_1.__importDefault)(require("discord-ytdl-core")); | ||
const voice_1 = require("@discordjs/voice"); | ||
const Util_1 = require("../utils/Util"); | ||
const youtube_sr_1 = __importDefault(require("youtube-sr")); | ||
const AudioFilters_1 = __importDefault(require("../utils/AudioFilters")); | ||
const youtube_sr_1 = (0, tslib_1.__importDefault)(require("youtube-sr")); | ||
const AudioFilters_1 = (0, tslib_1.__importDefault)(require("../utils/AudioFilters")); | ||
const PlayerError_1 = require("./PlayerError"); | ||
@@ -129,3 +107,3 @@ class Queue { | ||
var _a, _b; | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -139,3 +117,3 @@ return (_b = (_a = this.connection.audioResource) === null || _a === void 0 ? void 0 : _a.metadata) !== null && _b !== void 0 ? _b : this.tracks[0]; | ||
get destroyed() { | ||
return __classPrivateFieldGet(this, _Queue_destroyed, "f"); | ||
return (0, tslib_1.__classPrivateFieldGet)(this, _Queue_destroyed, "f"); | ||
} | ||
@@ -147,3 +125,3 @@ /** | ||
nowPlaying() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -158,4 +136,4 @@ return this.current; | ||
connect(channel) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -171,3 +149,3 @@ const _channel = this.guild.channels.resolve(channel); | ||
if (_channel.type === "GUILD_STAGE_VOICE") { | ||
yield _channel.guild.me.voice.setSuppressed(false).catch(() => __awaiter(this, void 0, void 0, function* () { | ||
yield _channel.guild.me.voice.setSuppressed(false).catch(() => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
return yield _channel.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); | ||
@@ -177,3 +155,3 @@ })); | ||
this.connection.on("error", (err) => { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return; | ||
@@ -183,3 +161,3 @@ this.player.emit("connectionError", this, err); | ||
this.connection.on("debug", (msg) => { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return; | ||
@@ -191,3 +169,3 @@ this.player.emit("debug", this, msg); | ||
var _a; | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return; | ||
@@ -199,4 +177,4 @@ this.playing = true; | ||
}); | ||
this.connection.on("finish", (resource) => __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
this.connection.on("finish", (resource) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return; | ||
@@ -215,15 +193,13 @@ this.playing = false; | ||
} | ||
else if (!this.tracks.length && this.repeatMode === types_1.QueueRepeatMode.AUTOPLAY) { | ||
this._handleAutoplay(Util_1.Util.last(this.previousTracks)); | ||
} | ||
else { | ||
if (this.repeatMode !== types_1.QueueRepeatMode.AUTOPLAY) { | ||
if (this.repeatMode === types_1.QueueRepeatMode.TRACK) | ||
return void this.play(Util_1.Util.last(this.previousTracks), { immediate: true }); | ||
if (this.repeatMode === types_1.QueueRepeatMode.QUEUE) | ||
this.tracks.push(Util_1.Util.last(this.previousTracks)); | ||
const nextTrack = this.tracks.shift(); | ||
this.play(nextTrack, { immediate: true }); | ||
return; | ||
} | ||
else { | ||
this._handleAutoplay(Util_1.Util.last(this.previousTracks)); | ||
} | ||
if (this.repeatMode === types_1.QueueRepeatMode.TRACK) | ||
return void this.play(Util_1.Util.last(this.previousTracks), { immediate: true }); | ||
if (this.repeatMode === types_1.QueueRepeatMode.QUEUE) | ||
this.tracks.push(Util_1.Util.last(this.previousTracks)); | ||
const nextTrack = this.tracks.shift(); | ||
this.play(nextTrack, { immediate: true }); | ||
return; | ||
} | ||
@@ -241,3 +217,3 @@ })); | ||
var _a; | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -250,3 +226,3 @@ if (this.connection) | ||
this.player.voiceUtils.cache.delete(this.guild.id); | ||
__classPrivateFieldSet(this, _Queue_destroyed, true, "f"); | ||
(0, tslib_1.__classPrivateFieldSet)(this, _Queue_destroyed, true, "f"); | ||
} | ||
@@ -258,3 +234,3 @@ /** | ||
skip() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -273,3 +249,3 @@ if (!this.connection) | ||
addTrack(track) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -286,3 +262,3 @@ if (!(track instanceof Track_1.default)) | ||
addTracks(tracks) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -300,3 +276,3 @@ if (!tracks.every((y) => y instanceof Track_1.default)) | ||
setPaused(paused) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -314,3 +290,3 @@ if (!this.connection) | ||
var _a, _b, _c, _d; | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -329,7 +305,7 @@ if (!((_b = (_a = this.connection) === null || _a === void 0 ? void 0 : _a.audioResource) === null || _b === void 0 ? void 0 : _b.encoder)) | ||
setVolume(amount) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
if (!this.connection) | ||
return false; | ||
__classPrivateFieldSet(this, _Queue_lastVolume, amount, "f"); | ||
(0, tslib_1.__classPrivateFieldSet)(this, _Queue_lastVolume, amount, "f"); | ||
this.options.initialVolume = amount; | ||
@@ -344,3 +320,3 @@ return this.connection.setVolume(amount); | ||
setRepeatMode(mode) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -359,3 +335,3 @@ if (![types_1.QueueRepeatMode.OFF, types_1.QueueRepeatMode.QUEUE, types_1.QueueRepeatMode.TRACK, types_1.QueueRepeatMode.AUTOPLAY].includes(mode)) | ||
get volume() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -374,3 +350,3 @@ if (!this.connection) | ||
get streamTime() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -387,3 +363,3 @@ if (!this.connection) | ||
set streamTime(time) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -397,3 +373,3 @@ this.seek(time); | ||
getFiltersEnabled() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -407,3 +383,3 @@ return AudioFilters_1.default.names.filter((x) => this._activeFilters.includes(x)); | ||
getFiltersDisabled() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -418,4 +394,4 @@ return AudioFilters_1.default.names.filter((x) => !this._activeFilters.includes(x)); | ||
setFilters(filters) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -457,4 +433,4 @@ if (!filters || !Object.keys(filters).length) { | ||
seek(position) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -480,4 +456,4 @@ if (!this.playing || !this.current) | ||
back() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -494,3 +470,3 @@ const prev = this.previousTracks[this.previousTracks.length - 2]; // because last item is the current track | ||
clear() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -505,3 +481,3 @@ this.tracks = []; | ||
stop() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -515,3 +491,3 @@ return this.destroy(); | ||
shuffle() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -534,3 +510,3 @@ if (!this.tracks.length || this.tracks.length < 3) | ||
remove(track) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -558,3 +534,3 @@ let trackFound = null; | ||
getTrackPosition(track) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -571,3 +547,3 @@ if (typeof track === "number") | ||
jump(track) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -586,3 +562,3 @@ const foundTrack = this.remove(track); | ||
skipTo(track) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -602,3 +578,3 @@ const trackIndex = this.getTrackPosition(track); | ||
insert(track, index = 0) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -623,3 +599,3 @@ if (!track || !(track instanceof Track_1.default)) | ||
getPlayerTimestamp() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -642,3 +618,3 @@ const currentStreamTime = this.streamTime; | ||
createProgressBar(options = { timecodes: true }) { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -675,3 +651,3 @@ const length = typeof options.length === "number" ? (options.length <= 0 || options.length === Infinity ? 15 : options.length) : 15; | ||
get totalTime() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -688,4 +664,4 @@ return this.tracks.length > 0 ? this.tracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0; | ||
var _a, _b, _c, _d; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this, false)) | ||
return; | ||
@@ -769,3 +745,3 @@ if (!this.connection || !this.connection.voiceConnection) | ||
this.connection.playStream(resource); | ||
}, __classPrivateFieldGet(this, _Queue_instances, "m", _Queue_getBufferingTimeout).call(this)).unref(); | ||
}, (0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_getBufferingTimeout).call(this)).unref(); | ||
}); | ||
@@ -781,4 +757,4 @@ } | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -813,3 +789,3 @@ if (!track || ![track.source, (_a = track.raw) === null || _a === void 0 ? void 0 : _a.source].includes("youtube")) { | ||
*[(_Queue_lastVolume = new WeakMap(), _Queue_destroyed = new WeakMap(), _Queue_instances = new WeakSet(), Symbol.iterator)]() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -824,3 +800,3 @@ yield* this.tracks; | ||
var _a, _b; | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -840,3 +816,3 @@ return { | ||
toString() { | ||
if (__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this)) | ||
return; | ||
@@ -850,3 +826,3 @@ if (!this.tracks.length) | ||
_Queue_watchDestroyed = function _Queue_watchDestroyed(emit = true) { | ||
if (__classPrivateFieldGet(this, _Queue_destroyed, "f")) { | ||
if ((0, tslib_1.__classPrivateFieldGet)(this, _Queue_destroyed, "f")) { | ||
if (emit) | ||
@@ -853,0 +829,0 @@ this.player.emit("error", this, new PlayerError_1.PlayerError("Cannot use destroyed queue", PlayerError_1.ErrorStatusCode.DESTROYED_QUEUE)); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StreamDispatcher = void 0; | ||
const tslib_1 = require("tslib"); | ||
const voice_1 = require("@discordjs/voice"); | ||
@@ -48,3 +40,3 @@ const tiny_typed_emitter_1 = require("tiny-typed-emitter"); | ||
this.paused = false; | ||
this.voiceConnection.on("stateChange", (_, newState) => __awaiter(this, void 0, void 0, function* () { | ||
this.voiceConnection.on("stateChange", (_, newState) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if (newState.status === voice_1.VoiceConnectionStatus.Disconnected) { | ||
@@ -182,3 +174,3 @@ if (newState.reason === voice_1.VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) { | ||
playStream(resource = this.audioResource) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if (!resource) | ||
@@ -185,0 +177,0 @@ throw new PlayerError_1.PlayerError("Audio resource is not available!", PlayerError_1.ErrorStatusCode.NO_AUDIO_RESOURCE); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VoiceUtils = void 0; | ||
const tslib_1 = require("tslib"); | ||
const discord_js_1 = require("discord.js"); | ||
@@ -35,3 +27,3 @@ const voice_1 = require("@discordjs/voice"); | ||
connect(channel, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const conn = yield this.join(channel, options); | ||
@@ -51,3 +43,3 @@ const sub = new StreamDispatcher_1.StreamDispatcher(conn, channel, options.maxTime); | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
let conn = (0, voice_1.joinVoiceChannel)({ | ||
@@ -54,0 +46,0 @@ guildId: channel.guild.id, |
{ | ||
"name": "discord-player", | ||
"version": "5.1.0-dev.1635854838.a0badb8", | ||
"version": "5.1.0-dev.1636095464.54bb4b0", | ||
"description": "Complete framework to facilitate music commands using discord.js", | ||
@@ -63,3 +63,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@discordjs/voice": "^0.6.0", | ||
"@discordjs/voice": "^0.7.2", | ||
"discord-ytdl-core": "^5.0.4", | ||
@@ -70,29 +70,29 @@ "libsodium-wrappers": "^0.7.9", | ||
"tiny-typed-emitter": "^2.1.0", | ||
"youtube-sr": "^4.1.7", | ||
"youtube-sr": "^4.1.9", | ||
"ytdl-core": "^4.9.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@babel/cli": "^7.16.0", | ||
"@babel/core": "^7.16.0", | ||
"@babel/preset-env": "^7.16.0", | ||
"@babel/preset-typescript": "^7.16.0", | ||
"@devsnowflake/docgen": "devsnowflake/docgen#ts-patch", | ||
"@discord-player/extractor": "^3.0.2", | ||
"@discordjs/opus": "github:discordjs/opus", | ||
"@favware/rollup-type-bundler": "^1.0.3", | ||
"@types/node": "^16.9.6", | ||
"@favware/rollup-type-bundler": "^1.0.6", | ||
"@types/node": "^16.11.6", | ||
"@types/ws": "^8.2.0", | ||
"@typescript-eslint/eslint-plugin": "^4.31.2", | ||
"@typescript-eslint/parser": "^4.31.2", | ||
"discord-api-types": "^0.23.1", | ||
"discord.js": "^13.1.0", | ||
"eslint": "^7.32.0", | ||
"@typescript-eslint/eslint-plugin": "^5.3.0", | ||
"@typescript-eslint/parser": "^5.3.0", | ||
"discord-api-types": "^0.24.0", | ||
"discord.js": "^13.3.1", | ||
"eslint": "^8.1.0", | ||
"gen-esm-wrapper": "^1.1.3", | ||
"husky": "^7.0.2", | ||
"husky": "^7.0.4", | ||
"jsdoc-babel": "^0.5.0", | ||
"prettier": "^2.4.1", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.4.3" | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.4.4" | ||
} | ||
} |
@@ -102,3 +102,3 @@ # Discord Player | ||
// /play Despacito | ||
// /play track:Despacito | ||
// will play "Despacito" in the voice channel | ||
@@ -160,5 +160,6 @@ if (interaction.commandName === "play") { | ||
* **[Discord Music Bot](https://github.com/Androz2091/discord-music-bot)** by [Androz2091](https://github.com/Androz2091) | ||
* [Musico](https://github.com/Whirl21/Musico) by [Whirl21](https://github.com/Whirl21) | ||
* [Music-bot](https://github.com/ZerioDev/Music-bot) by [ZerioDev](https://github.com/ZerioDev) | ||
* [AtlantaBot](https://github.com/Androz2091/AtlantaBot) by [Androz2091](https://github.com/Androz2091) (**outdated**) | ||
* [Discord-Music](https://github.com/inhydrox/discord-music) by [inhydrox](https://github.com/inhydrox) (**outdated**) | ||
* [Music-bot](https://github.com/ZerioDev/Music-bot) by [ZerioDev](https://github.com/ZerioDev) (**outdated**) | ||
@@ -221,2 +222,2 @@ ## Advanced | ||
`<Queue>.onBeforeCreateStream` is called before actually downloading the stream. It is a different concept from extractors, where you are **just** downloading | ||
streams. `source` here will be a video source. Streams from `onBeforeCreateStream` are then piped to `FFmpeg` and finally sent to Discord voice servers. | ||
streams. `source` here will be a video source. Streams from `onBeforeCreateStream` are then piped to `FFmpeg` and finally sent to Discord voice servers. |
221
151099
3534
+ Added@discordjs/voice@0.7.5(transitive)
+ Added@types/ws@8.5.14(transitive)
+ Addeddiscord-api-types@0.24.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedws@8.18.1(transitive)
- Removed@discordjs/voice@0.6.0(transitive)
- Removed@types/ws@7.4.7(transitive)
- Removeddiscord-api-types@0.22.0(transitive)
- Removedws@7.5.10(transitive)
Updated@discordjs/voice@^0.7.2
Updatedyoutube-sr@^4.1.9