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.9dc01b68bbe7cd1414da1018abd0ecad20305dd1 to 5.0.0-dev.f0259b39ce43dd051629738e9c6b3c2918114ab5

28

lib/Player.js

@@ -26,2 +26,3 @@ "use strict";

const spotify_url_info_1 = __importDefault(require("spotify-url-info"));
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -61,3 +62,3 @@ const soundcloud_scraper_1 = require("soundcloud-scraper");

if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.autoRegisterExtractor) {
let nv;
let nv; // eslint-disable-line @typescript-eslint/no-explicit-any
if ((nv = Util_1.Util.require("@discord-player/extractor"))) {

@@ -152,3 +153,3 @@ ["Attachment", "Facebook", "Reverbnation", "Vimeo"].forEach((ext) => void this.use(ext, nv[ext]));

}
catch (_a) { }
catch (_a) { } // eslint-disable-line no-empty
this.queues.delete(guild.id);

@@ -178,2 +179,3 @@ return prev;

options.searchEngine = types_1.QueryType.AUTO;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [_, extractor] of this.extractors) {

@@ -198,3 +200,3 @@ if (!extractor.validate(query))

type: "video"
}).catch(() => { });
}).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!videos)

@@ -204,3 +206,3 @@ return { playlist: null, tracks: [] };

var _a, _b;
m.source = "youtube";
m.source = "youtube"; // eslint-disable-line @typescript-eslint/no-explicit-any
return new Track_1.default(this, {

@@ -222,3 +224,4 @@ title: m.title,

case types_1.QueryType.SOUNDCLOUD_SEARCH: {
const result = QueryResolver_1.QueryResolver.resolve(query) === types_1.QueryType.SOUNDCLOUD_TRACK ? [{ url: query }] : yield soundcloud.search(query, "track").catch(() => { });
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
const result = QueryResolver_1.QueryResolver.resolve(query) === types_1.QueryType.SOUNDCLOUD_TRACK ? [{ url: query }] : yield soundcloud.search(query, "track").catch(Util_1.Util.noop);
if (!result || !result.length)

@@ -228,3 +231,3 @@ return { playlist: null, tracks: [] };

for (const r of result) {
const trackInfo = yield soundcloud.getSongInfo(r.url).catch(() => { });
const trackInfo = yield soundcloud.getSongInfo(r.url).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!trackInfo)

@@ -249,3 +252,3 @@ continue;

case types_1.QueryType.SPOTIFY_SONG: {
const spotifyData = yield spotify_url_info_1.default.getData(query).catch(() => { });
const spotifyData = yield spotify_url_info_1.default.getData(query).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!spotifyData)

@@ -270,3 +273,3 @@ return { playlist: null, tracks: [] };

case types_1.QueryType.SPOTIFY_ALBUM: {
const spotifyPlaylist = yield spotify_url_info_1.default.getData(query).catch(() => { });
const spotifyPlaylist = yield spotify_url_info_1.default.getData(query).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!spotifyPlaylist)

@@ -295,2 +298,3 @@ return { playlist: null, tracks: [] };

if (spotifyPlaylist.type !== "playlist") {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
playlist.tracks = spotifyPlaylist.tracks.items.map((m) => {

@@ -314,2 +318,3 @@ var _a, _b, _c, _d, _e, _f, _g, _h;

else {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
playlist.tracks = spotifyPlaylist.tracks.items.map((m) => {

@@ -335,3 +340,3 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j;

case types_1.QueryType.SOUNDCLOUD_PLAYLIST: {
const data = yield soundcloud_scraper_1.Client.getPlaylist(query).catch(() => { });
const data = yield soundcloud_scraper_1.Client.getPlaylist(query).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!data)

@@ -373,7 +378,7 @@ return { playlist: null, tracks: [] };

case types_1.QueryType.YOUTUBE_PLAYLIST: {
const ytpl = yield youtube_sr_1.default.getPlaylist(query).catch(() => { });
const ytpl = yield youtube_sr_1.default.getPlaylist(query).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!ytpl)
return { playlist: null, tracks: [] };
// @todo: better way of handling large playlists
yield ytpl.fetch().catch(() => { });
yield ytpl.fetch().catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
const playlist = new Playlist_1.Playlist(this, {

@@ -424,2 +429,3 @@ title: ytpl.title,

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
use(extractorName, extractor, force = false) {

@@ -426,0 +432,0 @@ if (!extractorName)

@@ -19,2 +19,3 @@ "use strict";

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(extractorName, data) {

@@ -47,3 +48,5 @@ /**

playlist: (_a = data.playlist) !== null && _a !== void 0 ? _a : null,
data: (_c = (_b = data.info) === null || _b === void 0 ? void 0 : _b.map((m) => ({
data:
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(_c = (_b = data.info) === null || _b === void 0 ? void 0 : _b.map((m) => ({
title: m.title,

@@ -50,0 +53,0 @@ duration: m.duration,

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

this._cooldownsTimeout = new discord_js_1.Collection();
this._activeFilters = [];
this._activeFilters = []; // eslint-disable-line @typescript-eslint/no-explicit-any
this._filtersUpdate = false;

@@ -139,13 +139,13 @@ this.destroyed = false;

if (channel.type === "stage")
yield channel.guild.me.voice.setRequestToSpeak(true).catch(() => { });
yield channel.guild.me.voice.setRequestToSpeak(true).catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
this.connection.on("error", (err) => this.player.emit("connectionError", this, err));
this.connection.on("debug", (msg) => this.player.emit("debug", this, msg));
this.player.emit("connectionCreate", this, this.connection);
this.connection.on("start", () => {
this.connection.on("start", (resource) => {
this.playing = true;
if (!this._filtersUpdate)
this.player.emit("trackStart", this, this.current);
this.player.emit("trackStart", this, resource.metadata);
this._filtersUpdate = false;
});
this.connection.on("finish", () => __awaiter(this, void 0, void 0, function* () {
this.connection.on("finish", (resource) => __awaiter(this, void 0, void 0, function* () {
this.playing = false;

@@ -155,2 +155,3 @@ if (this._filtersUpdate)

this._streamTime = 0;
this.previousTracks.push(resource.metadata);
if (!this.tracks.length && this.repeatMode === types_1.QueueRepeatMode.OFF) {

@@ -211,2 +212,4 @@ if (this.options.leaveOnEnd)

__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!(track instanceof Track_1.default))
throw new Error("invalid track");
this.tracks.push(track);

@@ -221,2 +224,4 @@ this.player.emit("trackAdd", this, track);

__classPrivateFieldGet(this, _Queue_instances, "m", _Queue_watchDestroyed).call(this);
if (!tracks.every((y) => y instanceof Track_1.default))
throw new Error("invalid track");
this.tracks.push(...tracks);

@@ -339,3 +344,3 @@ this.player.emit("tracksAdd", this, tracks);

}
const _filters = [];
const _filters = []; // eslint-disable-line @typescript-eslint/no-explicit-any
for (const filter in filters) {

@@ -417,3 +422,2 @@ if (filters[filter] === true)

this.previousTracks = this.previousTracks.filter((x) => x._trackID !== track._trackID);
this.previousTracks.push(track);
}

@@ -472,3 +476,3 @@ let stream;

.then((x) => x.related_videos[0])
.catch(() => { });
.catch(Util_1.Util.noop); // eslint-disable-line @typescript-eslint/no-empty-function
if (!info) {

@@ -475,0 +479,0 @@ if (this.options.leaveOnEnd)

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

toString() {
return this.names.map((m) => this[m]).join(",");
return this.names.map((m) => this[m]).join(","); // eslint-disable-line @typescript-eslint/no-explicit-any
},

@@ -92,0 +92,0 @@ create(filter) {

@@ -7,2 +7,3 @@ "use strict";

const types_1 = require("../types/types");
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore

@@ -9,0 +10,0 @@ const soundcloud_scraper_1 = require("soundcloud-scraper");

@@ -13,3 +13,3 @@ import { StageChannel, VoiceChannel } from "discord.js";

*/
static durationString(durObj: object): string;
static durationString(durObj: Record<string, number>): string;
/**

@@ -51,3 +51,4 @@ * Parses milliseconds to consumable time object

static wait(time: number): Promise<unknown>;
static get noop(): () => void;
}
export { Util };

@@ -55,2 +55,3 @@ "use strict";

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static last(arr) {

@@ -90,3 +91,6 @@ if (!Array.isArray(arr))

}
static get noop() {
return () => { }; // eslint-disable-line @typescript-eslint/no-empty-function
}
}
exports.Util = Util;

@@ -10,4 +10,4 @@ /// <reference types="node" />

debug: (message: string) => any;
start: () => any;
finish: () => any;
start: (resource: AudioResource<Track>) => any;
finish: (resource: AudioResource<Track>) => any;
}

@@ -14,0 +14,0 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {

@@ -79,4 +79,4 @@ "use strict";

if (!this.paused) {
void this.emit("finish", this.audioResource);
this.audioResource = null;
void this.emit("finish");
}

@@ -86,3 +86,3 @@ }

if (!this.paused)
void this.emit("start");
void this.emit("start", this.audioResource);
}

@@ -100,2 +100,3 @@ });

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createStream(src, ops) {

@@ -126,3 +127,3 @@ var _a;

}
catch (_a) { }
catch (_a) { } // eslint-disable-line no-empty
}

@@ -129,0 +130,0 @@ /**

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

@@ -13,6 +13,8 @@ "main": "lib/index.js",

"build": "rimraf lib && tsc",
"build:check": "tsc --noEmit --incremental false",
"format": "prettier --write \"src/**/*.ts\" \"example/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"docs": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml --output docs/docs.json",
"docs:test": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml"
"docs:test": "docgen --jsdoc jsdoc.json --source src/*.ts src/**/*.ts --custom docs/index.yml",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix"
},

@@ -72,5 +74,8 @@ "funding": "https://github.com/Androz2091/discord-player?sponsor=1",

"@types/ws": "^7.4.4",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"discord-api-types": "^0.18.1",
"discord.js": "^13.0.0-dev.c850ae10270076c4b2e10b130dd8f88eed4ed201",
"discord.js-docgen": "discordjs/docgen#ts-patch",
"eslint": "^7.29.0",
"jsdoc-babel": "^0.5.0",

@@ -80,6 +85,4 @@ "prettier": "^2.3.1",

"ts-node": "^10.0.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.3.2"
"typescript": "^4.3.4"
}
}
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