New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord-player

Package Overview
Dependencies
Maintainers
2
Versions
367
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-player - npm Package Compare versions

Comparing version 5.0.0-dev.c925ca442e9f8374e6db7b7baa1c6efd0f165028 to 5.0.0-dev.d9973cf316d7b3dc6efd16d897781ab2d8e5cb71

lib/VoiceInterface/StreamDispatcher.d.ts

3

lib/index.d.ts

@@ -7,8 +7,7 @@ export { AudioFilters } from "./utils/AudioFilters";

export { Queue } from "./Structures/Queue";
export { StreamUtils } from "./utils/StreamUtils";
export { Track } from "./Structures/Track";
export { Util } from "./utils/Util";
export { VoiceUtils } from "./VoiceInterface/VoiceUtils";
export { VoiceEvents, StreamDispatcher } from "./VoiceInterface/BasicStreamDispatcher";
export { VoiceEvents, StreamDispatcher } from "./VoiceInterface/StreamDispatcher";
export { VoiceAdapterCreator } from "./VoiceInterface/AdapterCreator";
export * from "./types/types";

@@ -13,3 +13,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.VoiceAdapterCreator = exports.StreamDispatcher = exports.VoiceUtils = exports.Util = exports.Track = exports.StreamUtils = exports.Queue = exports.QueryResolver = exports.Player = exports.Playlist = exports.ExtractorModel = exports.AudioFilters = void 0;
exports.VoiceAdapterCreator = exports.StreamDispatcher = exports.VoiceUtils = exports.Util = exports.Track = exports.Queue = exports.QueryResolver = exports.Player = exports.Playlist = exports.ExtractorModel = exports.AudioFilters = void 0;
var AudioFilters_1 = require("./utils/AudioFilters");

@@ -27,4 +27,2 @@ Object.defineProperty(exports, "AudioFilters", { enumerable: true, get: function () { return AudioFilters_1.AudioFilters; } });

Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return Queue_1.Queue; } });
var StreamUtils_1 = require("./utils/StreamUtils");
Object.defineProperty(exports, "StreamUtils", { enumerable: true, get: function () { return StreamUtils_1.StreamUtils; } });
var Track_1 = require("./Structures/Track");

@@ -36,6 +34,6 @@ Object.defineProperty(exports, "Track", { enumerable: true, get: function () { return Track_1.Track; } });

Object.defineProperty(exports, "VoiceUtils", { enumerable: true, get: function () { return VoiceUtils_1.VoiceUtils; } });
var BasicStreamDispatcher_1 = require("./VoiceInterface/BasicStreamDispatcher");
Object.defineProperty(exports, "StreamDispatcher", { enumerable: true, get: function () { return BasicStreamDispatcher_1.StreamDispatcher; } });
var StreamDispatcher_1 = require("./VoiceInterface/StreamDispatcher");
Object.defineProperty(exports, "StreamDispatcher", { enumerable: true, get: function () { return StreamDispatcher_1.StreamDispatcher; } });
var AdapterCreator_1 = require("./VoiceInterface/AdapterCreator");
Object.defineProperty(exports, "VoiceAdapterCreator", { enumerable: true, get: function () { return AdapterCreator_1.VoiceAdapterCreator; } });
__exportStar(require("./types/types"), exports);

@@ -5,3 +5,3 @@ import { Client, Collection, GuildResolvable } from "discord.js";

import { VoiceUtils } from "./VoiceInterface/VoiceUtils";
import { PlayerEvents, PlayerOptions, SearchOptions, DiscordPlayerInitOptions } from "./types/types";
import { PlayerEvents, PlayerOptions, SearchOptions, PlayerInitOptions } from "./types/types";
import Track from "./Structures/Track";

@@ -12,3 +12,3 @@ import { Playlist } from "./Structures/Playlist";

readonly client: Client;
readonly options: DiscordPlayerInitOptions;
readonly options: PlayerInitOptions;
readonly queues: Collection<`${bigint}`, Queue<unknown>>;

@@ -20,5 +20,5 @@ readonly voiceUtils: VoiceUtils;

* @param {Client} client The Discord Client
* @param {DiscordPlayerInitOptions} [options={}] The player init options
* @param {PlayerInitOptions} [options={}] The player init options
*/
constructor(client: Client, options?: DiscordPlayerInitOptions);
constructor(client: Client, options?: PlayerInitOptions);
/**

@@ -87,4 +87,10 @@ * Handles voice state update

scanDeps(): string;
/**
* Resolves qeuue
* @param {GuildResolvable|Queue} queueLike Queue like object
* @returns {Queue}
*/
resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
[Symbol.iterator](): Generator<Queue<unknown>, void, undefined>;
}
export { Player };

@@ -37,3 +37,3 @@ "use strict";

* @param {Client} client The Discord Client
* @param {DiscordPlayerInitOptions} [options={}] The player init options
* @param {PlayerInitOptions} [options={}] The player init options
*/

@@ -79,3 +79,2 @@ constructor(client, options = {}) {

return;
// update channel
if (oldState.channelID && newState.channelID && oldState.channelID !== newState.channelID) {

@@ -138,3 +137,3 @@ queue.connection.channel = newState.channel;

*/
createQueue(guild, queueInitOptions) {
createQueue(guild, queueInitOptions = {}) {
var _a;

@@ -205,2 +204,4 @@ guild = this.client.guilds.resolve(guild);

for (const [_, extractor] of this.extractors) {
if (options.blockExtractor)
break;
if (!extractor.validate(query))

@@ -396,3 +397,2 @@ continue;

return { playlist: null, tracks: [] };
// @todo: better way of handling large playlists
yield ytpl.fetch().catch(Util_1.Util.noop);

@@ -481,2 +481,10 @@ const playlist = new Playlist_1.Playlist(this, {

}
/**
* Resolves qeuue
* @param {GuildResolvable|Queue} queueLike Queue like object
* @returns {Queue}
*/
resolveQueue(queueLike) {
return this.getQueue(queueLike instanceof Queue_1.Queue ? queueLike.guild : queueLike);
}
*[Symbol.iterator]() {

@@ -483,0 +491,0 @@ yield* Array.from(this.queues.values());

/// <reference types="node" />
import { Collection, Guild, StageChannel, VoiceChannel } from "discord.js";
import { Collection, Guild, Snowflake, GuildChannelResolvable } from "discord.js";
import { Player } from "../Player";
import { StreamDispatcher } from "../VoiceInterface/BasicStreamDispatcher";
import { StreamDispatcher } from "../VoiceInterface/StreamDispatcher";
import Track from "./Track";
import { PlayerOptions, PlayOptions, QueueFilters, QueueRepeatMode } from "../types/types";
import { PlayerOptions, PlayerProgressbarOptions, PlayOptions, QueueFilters, QueueRepeatMode } from "../types/types";
declare class Queue<T = unknown> {

@@ -18,2 +18,3 @@ #private;

repeatMode: QueueRepeatMode;
readonly id: Snowflake;
private _streamTime;

@@ -23,3 +24,2 @@ _cooldownsTimeout: Collection<string, NodeJS.Timeout>;

private _filtersUpdate;
destroyed: boolean;
/**

@@ -38,2 +38,7 @@ * Queue constructor

/**
* If this queue is destroyed
* @type {boolean}
*/
get destroyed(): boolean;
/**
* Returns current track

@@ -45,6 +50,6 @@ * @returns {Track}

* Connects to a voice channel
* @param {StageChannel|VoiceChannel} channel The voice/stage channel
* @param {GuildChannelResolvable} channel The voice/stage channel
* @returns {Promise<Queue>}
*/
connect(channel: StageChannel | VoiceChannel): Promise<this>;
connect(channel: GuildChannelResolvable): Promise<this>;
/**

@@ -103,2 +108,12 @@ * Destroys this queue

/**
* Mutes the playback
* @returns {void}
*/
mute(): void;
/**
* Unmutes the playback. If the last volume was set to 0, unmute will produce no effect.
* @returns {void}
*/
unmute(): void;
/**
* The stream time of this queue

@@ -108,2 +123,3 @@ * @type {number}

get streamTime(): number;
set streamTime(time: number);
/**

@@ -141,2 +157,56 @@ * Returns enabled filters

/**
* Stops the player
* @returns {void}
*/
stop(): void;
/**
* Shuffles this queue
* @returns {boolean}
*/
shuffle(): boolean;
/**
* Removes a track from the queue
* @param {Track|Snowflake|number} track The track to remove
* @returns {Track}
*/
remove(track: Track | Snowflake | number): Track;
/**
* Jumps to particular track
* @param {Track|number} track The track
* @returns {void}
*/
jump(track: Track | number): void;
/**
* Inserts the given track to specified index
* @param {Track} track The track to insert
* @param {number} [index=0] The index where this track should be
*/
insert(track: Track, index?: number): void;
/**
* @typedef {object} PlayerTimestamp
* @property {string} current The current progress
* @property {string} end The total time
* @property {number} progress Progress in %
*/
/**
* Returns player stream timestamp
* @returns {PlayerTimestamp}
*/
getPlayerTimestamp(): {
current: string;
end: string;
progress: number;
};
/**
* Creates progress bar string
* @param {PlayerProgressbarOptions} options The progress bar options
* @returns {string}
*/
createProgressBar(options?: PlayerProgressbarOptions): string;
/**
* Total duration
* @type {Number}
*/
get totalTime(): number;
/**
* Play stream in a voice/stage channel

@@ -152,2 +222,3 @@ * @param {Track} [src] The track to play (if empty, uses first track from the queue)

* @returns {Promise<void>}
* @private
*/

@@ -161,2 +232,3 @@ private _handleAutoplay;

toJSON(): {
id: `${bigint}`;
guild: `${bigint}`;

@@ -163,0 +235,0 @@ voiceChannel: `${bigint}`;

@@ -16,6 +16,12 @@ "use strict";

};
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_watchDestroyed;
var _Queue_instances, _Queue_lastVolume, _Queue_destroyed, _Queue_watchDestroyed;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -45,2 +51,3 @@ exports.Queue = void 0;

this.repeatMode = 0;
this.id = discord_js_1.SnowflakeUtil.generate();
this._streamTime = 0;

@@ -50,3 +57,4 @@ this._cooldownsTimeout = new discord_js_1.Collection();

this._filtersUpdate = false;
this.destroyed = false;
_Queue_lastVolume.set(this, 0);
_Queue_destroyed.set(this, false);
/**

@@ -70,7 +78,2 @@ * The player that instantiated this queue

/**
* If this queue is destroyed
* @type {boolean}
* @name Queue#destroyed
*/
/**
* Queue repeat mode

@@ -100,2 +103,7 @@ * @type {QueueRepeatMode}

*/
/**
* The ID of this queue
* @type {Snowflake}
* @name Queue#id
*/
Object.assign(this.options, {

@@ -121,2 +129,9 @@ leaveOnEnd: true,

/**
* If this queue is destroyed
* @type {boolean}
*/
get destroyed() {
return __classPrivateFieldGet(this, _Queue_destroyed, "f");
}
/**
* Returns current track

@@ -131,3 +146,3 @@ * @returns {Track}

* Connects to a voice channel
* @param {StageChannel|VoiceChannel} channel The voice/stage channel
* @param {GuildChannelResolvable} channel The voice/stage channel
* @returns {Promise<Queue>}

@@ -138,11 +153,12 @@ */

__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!["stage", "voice"].includes(channel === null || channel === void 0 ? void 0 : channel.type))
throw new TypeError(`Channel type must be voice or stage, got ${channel === null || channel === void 0 ? void 0 : channel.type}!`);
const connection = yield this.player.voiceUtils.connect(channel, {
const _channel = this.guild.channels.resolve(channel);
if (!["stage", "voice"].includes(_channel === null || _channel === void 0 ? void 0 : _channel.type))
throw new TypeError(`Channel type must be voice or stage, got ${_channel === null || _channel === void 0 ? void 0 : _channel.type}!`);
const connection = yield this.player.voiceUtils.connect(_channel, {
deaf: this.options.autoSelfDeaf
});
this.connection = connection;
if (channel.type === "stage") {
yield channel.guild.me.voice.setSuppressed(false).catch(() => __awaiter(this, void 0, void 0, function* () {
return yield channel.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop);
if (_channel.type === "stage") {
yield _channel.guild.me.voice.setSuppressed(false).catch(() => __awaiter(this, void 0, void 0, function* () {
return yield _channel.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop);
}));

@@ -196,8 +212,11 @@ }

destroy(disconnect = this.options.leaveOnStop) {
this.connection.end();
var _a;
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (this.connection)
this.connection.end();
if (disconnect)
this.connection.disconnect();
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.disconnect();
this.player.queues.delete(this.guild.id);
this.player.voiceUtils.cache.delete(this.guild.id);
this.destroyed = true;
__classPrivateFieldSet(this, _Queue_destroyed, true, "f");
}

@@ -273,2 +292,3 @@ /**

return false;
__classPrivateFieldSet(this, _Queue_lastVolume, amount, "f");
this.options.initialVolume = amount;

@@ -305,2 +325,18 @@ return this.connection.setVolume(amount);

/**
* Mutes the playback
* @returns {void}
*/
mute() {
const lv = __classPrivateFieldGet(this, _Queue_lastVolume, "f");
this.volume = 0;
__classPrivateFieldSet(this, _Queue_lastVolume, lv, "f");
}
/**
* Unmutes the playback. If the last volume was set to 0, unmute will produce no effect.
* @returns {void}
*/
unmute() {
this.volume = __classPrivateFieldGet(this, _Queue_lastVolume, "f");
}
/**
* The stream time of this queue

@@ -320,2 +356,6 @@ * @type {number}

}
set streamTime(time) {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
this.seek(time);
}
/**

@@ -418,2 +458,136 @@ * Returns enabled filters

/**
* Stops the player
* @returns {void}
*/
stop() {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
return this.destroy();
}
/**
* Shuffles this queue
* @returns {boolean}
*/
shuffle() {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!this.tracks.length || this.tracks.length < 3)
return false;
const currentTrack = this.tracks.shift();
for (let i = this.tracks.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[this.tracks[i], this.tracks[j]] = [this.tracks[j], this.tracks[i]];
}
this.tracks.unshift(currentTrack);
return true;
}
/**
* Removes a track from the queue
* @param {Track|Snowflake|number} track The track to remove
* @returns {Track}
*/
remove(track) {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
let trackFound = null;
if (typeof track === "number") {
trackFound = this.tracks[track];
if (trackFound) {
this.tracks = this.tracks.filter((t) => t.id !== trackFound.id);
}
}
else {
trackFound = this.tracks.find((s) => s.id === (track instanceof Track_1.default ? track.id : track));
if (trackFound) {
this.tracks = this.tracks.filter((s) => s.id !== trackFound.id);
}
}
return trackFound;
}
/**
* Jumps to particular track
* @param {Track|number} track The track
* @returns {void}
*/
jump(track) {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
const foundTrack = this.remove(track);
if (!foundTrack)
throw new Error("Track not found");
this.tracks.splice(1, 0, foundTrack);
return void this.skip();
}
/**
* Inserts the given track to specified index
* @param {Track} track The track to insert
* @param {number} [index=0] The index where this track should be
*/
insert(track, index = 0) {
if (!track || !(track instanceof Track_1.default))
throw new TypeError("track must be the instance of Track");
if (typeof index !== "number" || index < 0 || !Number.isFinite(index))
throw new Error(`Invalid index "${index}"`);
this.tracks.splice(index, 0, track);
this.player.emit("trackAdd", this, track);
}
/**
* @typedef {object} PlayerTimestamp
* @property {string} current The current progress
* @property {string} end The total time
* @property {number} progress Progress in %
*/
/**
* Returns player stream timestamp
* @returns {PlayerTimestamp}
*/
getPlayerTimestamp() {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
const currentStreamTime = this.streamTime;
const totalTime = this.current.durationMS;
const currentTimecode = Util_1.Util.buildTimeCode(Util_1.Util.parseMS(currentStreamTime));
const endTimecode = Util_1.Util.buildTimeCode(Util_1.Util.parseMS(totalTime));
return {
current: currentTimecode,
end: endTimecode,
progress: Math.round((currentStreamTime / totalTime) * 100)
};
}
/**
* Creates progress bar string
* @param {PlayerProgressbarOptions} options The progress bar options
* @returns {string}
*/
createProgressBar(options = { timecodes: true }) {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
const length = typeof options.length === "number" ? (options.length <= 0 || options.length === Infinity ? 15 : options.length) : 15;
const index = Math.round((this.streamTime / this.current.durationMS) * length);
const indicator = typeof options.indicator === "string" && options.indicator.length > 0 ? options.indicator : "🔘";
const line = typeof options.line === "string" && options.line.length > 0 ? options.line : "▬";
if (index >= 1 && index <= length) {
const bar = line.repeat(length - 1).split("");
bar.splice(index, 0, indicator);
if (options.timecodes) {
const timestamp = this.getPlayerTimestamp();
return `${timestamp.current} ┃ ${bar.join("")} ┃ ${timestamp.end}`;
}
else {
return `${bar.join("")}`;
}
}
else {
if (options.timecodes) {
const timestamp = this.getPlayerTimestamp();
return `${timestamp.current} ┃ ${indicator}${line.repeat(length - 1)} ┃ ${timestamp.end}`;
}
else {
return `${indicator}${line.repeat(length - 1)}`;
}
}
}
/**
* Total duration
* @type {Number}
*/
get totalTime() {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
return this.tracks.length > 0 ? this.tracks.map((t) => t.durationMS).reduce((p, c) => p + c) : 0;
}
/**
* Play stream in a voice/stage channel

@@ -427,3 +601,4 @@ * @param {Track} [src] The track to play (if empty, uses first track from the queue)

return __awaiter(this, void 0, void 0, function* () {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!this.destroyed)
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!this.connection || !this.connection.voiceConnection)

@@ -436,4 +611,5 @@ throw new Error("Voice connection is not available, use <Queue>.connect()!");

return;
this.player.emit("debug", this, "Received play request");
if (!options.filtersUpdate) {
this.previousTracks = this.previousTracks.filter((x) => x._trackID !== track._trackID);
this.previousTracks = this.previousTracks.filter((x) => x.id !== track.id);
this.previousTracks.push(track);

@@ -477,3 +653,3 @@ }

this.connection.playStream(resource).then(() => {
this.connection.setVolume(this.options.initialVolume);
this.setVolume(this.options.initialVolume);
});

@@ -486,2 +662,3 @@ });

* @returns {Promise<void>}
* @private
*/

@@ -519,3 +696,3 @@ _handleAutoplay(track) {

}
*[(_Queue_instances = new WeakSet(), Symbol.iterator)]() {
*[(_Queue_lastVolume = new WeakMap(), _Queue_destroyed = new WeakMap(), _Queue_instances = new WeakSet(), Symbol.iterator)]() {
__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);

@@ -532,2 +709,3 @@ yield* this.tracks;

return {
id: this.id,
guild: this.guild.id,

@@ -552,4 +730,4 @@ voiceChannel: (_b = (_a = this.connection) === null || _a === void 0 ? void 0 : _a.channel) === null || _b === void 0 ? void 0 : _b.id,

_Queue_watchDestroyed = function _Queue_watchDestroyed() {
if (this.destroyed)
if (__classPrivateFieldGet(this, _Queue_destroyed, "f"))
throw new Error("Cannot use destroyed queue");
};

@@ -1,2 +0,2 @@

import { User } from "discord.js";
import { User, Snowflake } from "discord.js";
import { Player } from "../Player";

@@ -18,3 +18,3 @@ import { RawTrackData, TrackJSON } from "../types/types";

readonly raw: RawTrackData;
readonly _trackID: number;
readonly id: Snowflake;
/**

@@ -21,0 +21,0 @@ * Track constructor

@@ -13,3 +13,3 @@ "use strict";

this.raw = {};
this._trackID = Date.now();
this.id = discord_js_1.SnowflakeUtil.generate();
/**

@@ -74,4 +74,4 @@ * The player that instantiated this Track

* The track id
* @name Track#_trackID
* @type {number}
* @name Track#id
* @type {Snowflake}
* @readonly

@@ -140,2 +140,3 @@ */

return {
id: this.id,
title: this.title,

@@ -142,0 +143,0 @@ description: this.description,

@@ -7,3 +7,3 @@ /// <reference types="node" />

import { Playlist } from "../Structures/Playlist";
import { StreamDispatcher } from "../VoiceInterface/BasicStreamDispatcher";
import { StreamDispatcher } from "../VoiceInterface/StreamDispatcher";
import { downloadOptions } from "ytdl-core";

@@ -112,3 +112,2 @@ export declare type FiltersName = keyof QueueFilters;

timecodes?: boolean;
queue?: boolean;
length?: number;

@@ -317,3 +316,4 @@ line?: string;

* @property {UserResolvable} requestedBy The user who requested this search
* @property {QueryType} searchEngine The query search engine
* @property {QueryType} [searchEngine=QueryType.AUTO] The query search engine
* @property {boolean} [blockExtractor=false] If it should block custom extractors
*/

@@ -323,2 +323,3 @@ export interface SearchOptions {

searchEngine?: QueryType;
blockExtractor?: boolean;
}

@@ -383,2 +384,3 @@ /**

export interface TrackJSON {
id: Snowflake;
title: string;

@@ -424,9 +426,9 @@ description: string;

/**
* @typedef {object} DiscordPlayerInitOptions
* @typedef {object} PlayerInitOptions
* @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
* @property {YTDLDownloadOptions} [ytdlOptions={}] The options passed to `ytdl-core`
*/
export interface DiscordPlayerInitOptions {
export interface PlayerInitOptions {
autoRegisterExtractor?: boolean;
ytdlOptions?: downloadOptions;
}

@@ -88,3 +88,3 @@ "use strict";

static wait(time) {
return new Promise((r) => setTimeout(r, time).unref());
return new Promise((r) => setTimeout(r, time));
}

@@ -91,0 +91,0 @@ static get noop() {

import { VoiceChannel, StageChannel, Collection, Snowflake } from "discord.js";
import { DiscordGatewayAdapterCreator, VoiceConnection } from "@discordjs/voice";
import { StreamDispatcher } from "./BasicStreamDispatcher";
import { StreamDispatcher } from "./StreamDispatcher";
declare class VoiceUtils {

@@ -5,0 +5,0 @@ cache: Collection<Snowflake, StreamDispatcher>;

@@ -15,3 +15,4 @@ "use strict";

const voice_1 = require("@discordjs/voice");
const BasicStreamDispatcher_1 = require("./BasicStreamDispatcher");
const StreamDispatcher_1 = require("./StreamDispatcher");
const AdapterCreator_1 = require("./AdapterCreator");
class VoiceUtils {

@@ -38,3 +39,3 @@ /**

const conn = yield this.join(channel, options);
const sub = new BasicStreamDispatcher_1.StreamDispatcher(conn, channel);
const sub = new StreamDispatcher_1.StreamDispatcher(conn, channel);
this.cache.set(channel.guild.id, sub);

@@ -51,3 +52,3 @@ return sub;

join(channel, options) {
var _a, _b;
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {

@@ -57,7 +58,7 @@ let conn = voice_1.joinVoiceChannel({

channelId: channel.id,
adapterCreator: (_a = options.adapter) !== null && _a !== void 0 ? _a : channel.guild.voiceAdapterCreator,
adapterCreator: (_b = (_a = options.adapter) !== null && _a !== void 0 ? _a : channel.guild.voiceAdapterCreator) !== null && _b !== void 0 ? _b : AdapterCreator_1.VoiceAdapterCreator(channel),
selfDeaf: Boolean(options.deaf)
});
try {
conn = yield voice_1.entersState(conn, voice_1.VoiceConnectionStatus.Ready, (_b = options === null || options === void 0 ? void 0 : options.maxTime) !== null && _b !== void 0 ? _b : 20000);
conn = yield voice_1.entersState(conn, voice_1.VoiceConnectionStatus.Ready, (_c = options === null || options === void 0 ? void 0 : options.maxTime) !== null && _c !== void 0 ? _c : 20000);
return conn;

@@ -77,3 +78,3 @@ }

disconnect(connection) {
if (connection instanceof BasicStreamDispatcher_1.StreamDispatcher)
if (connection instanceof StreamDispatcher_1.StreamDispatcher)
return connection.voiceConnection.destroy();

@@ -80,0 +81,0 @@ return connection.destroy();

{
"name": "discord-player",
"version": "5.0.0-dev.c925ca442e9f8374e6db7b7baa1c6efd0f165028",
"version": "5.0.0-dev.d9973cf316d7b3dc6efd16d897781ab2d8e5cb71",
"description": "Complete framework to facilitate music commands using discord.js",

@@ -55,3 +55,3 @@ "main": "lib/index.js",

"dependencies": {
"@discordjs/voice": "^0.5.0",
"@discordjs/voice": "^0.5.3",
"discord-ytdl-core": "^5.0.4",

@@ -62,26 +62,26 @@ "libsodium-wrappers": "^0.7.9",

"tiny-typed-emitter": "^2.0.3",
"youtube-sr": "^4.1.4",
"ytdl-core": "^4.8.2"
"youtube-sr": "^4.1.7",
"ytdl-core": "^4.8.3"
},
"devDependencies": {
"@babel/cli": "^7.14.5",
"@babel/core": "^7.14.5",
"@babel/preset-env": "^7.14.5",
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-typescript": "^7.14.5",
"@devsnowflake/docgen": "devsnowflake/docgen#ts-patch",
"@discord-player/extractor": "^3.0.2",
"@discordjs/opus": "^0.5.3",
"@types/node": "^15.12.2",
"@types/ws": "^7.4.4",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"@types/node": "^16.0.0",
"@types/ws": "^7.4.6",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"discord-api-types": "^0.18.1",
"discord.js": "^13.0.0-dev.c850ae10270076c4b2e10b130dd8f88eed4ed201",
"discord.js-docgen": "discordjs/docgen#ts-patch",
"eslint": "^7.29.0",
"discord.js": "13.0.0-dev.6d3d00b44577a70e840f0187d6894043677c5329",
"eslint": "^7.30.0",
"jsdoc-babel": "^0.5.0",
"prettier": "^2.3.1",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.4"
"typescript": "^4.3.5"
}
}

@@ -8,5 +8,4 @@ # Discord Player

[![wakatime](https://wakatime.com/badge/github/Androz2091/discord-player.svg)](https://wakatime.com/badge/github/Androz2091/discord-player)
[![CodeFactor](https://www.codefactor.io/repository/github/androz2091/discord-player/badge/v5)](https://www.codefactor.io/repository/github/androz2091/discord-player/overview/v5)
> V5 WIP
## Installation

@@ -96,3 +95,3 @@

const track = await client.player.search(args[0], {
searchEngine: QueryType.YOUTUBE_SEARCH
requestedBy: message.author
}).then(x => x.tracks[1]);

@@ -99,0 +98,0 @@ if (!track) return void message.reply("Track not found!");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc