Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-player

Package Overview
Dependencies
Maintainers
2
Versions
359
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.3.1 to 5.3.2-dev.0

8

dist/index.d.ts

@@ -269,5 +269,5 @@ /// <reference types="node" />

* @param {GuildResolvable} guild The guild id
* @returns {Queue}
* @returns {Queue | undefined}
*/
getQueue<T = unknown>(guild: GuildResolvable): Queue<T>;
getQueue<T = unknown>(guild: GuildResolvable): Queue<T> | undefined;
/**

@@ -370,2 +370,4 @@ * Deletes a queue and returns deleted queue object

connect(channel: GuildChannelResolvable): Promise<this>;
private emitEnd;
private refreshEndCooldown;
/**

@@ -676,2 +678,3 @@ * Destroys this queue

* @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
* @property {number} [leaveOnEndCooldown=1000] The cooldown in ms
* @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode

@@ -689,2 +692,3 @@ * @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options

leaveOnEnd?: boolean;
leaveOnEndCooldown?: number;
leaveOnStop?: boolean;

@@ -691,0 +695,0 @@ leaveOnEmpty?: boolean;

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

* @param {GuildResolvable} guild The guild id
* @returns {Queue}
* @returns {Queue | undefined}
*/

@@ -350,6 +350,7 @@ getQueue(guild) {

url: spotifyData.external_urls?.spotify ?? query,
thumbnail: spotifyData.album?.images[0]?.url ?? spotifyData.preview_url?.length
? `https://i.scdn.co/image/${spotifyData.preview_url?.split("?cid=")[1]}`
: "https://www.scdn.co/i/_global/twitter_card-default.jpg",
duration: Util_1.Util.buildTimeCode(Util_1.Util.parseMS(spotifyData.duration_ms)),
thumbnail: (spotifyData.coverArt?.sources?.[0]?.url ??
spotifyData.album?.images[0]?.url ??
(spotifyData.preview_url?.length && `https://i.scdn.co/image/${spotifyData.preview_url?.split("?cid=")[1]}`)) ||
"https://www.scdn.co/i/_global/twitter_card-default.jpg",
duration: Util_1.Util.buildTimeCode(Util_1.Util.parseMS(spotifyData.duration_ms ?? spotifyData.duration ?? spotifyData.maxDuration)),
views: 0,

@@ -371,3 +372,3 @@ requestedBy: options.requestedBy,

description: spotifyPlaylist.description ?? "",
thumbnail: spotifyPlaylist.images[0]?.url ?? "https://www.scdn.co/i/_global/twitter_card-default.jpg",
thumbnail: spotifyPlaylist.coverArt?.sources?.[0]?.url ?? spotifyPlaylist.images[0]?.url ?? "https://www.scdn.co/i/_global/twitter_card-default.jpg",
type: spotifyPlaylist.type,

@@ -374,0 +375,0 @@ source: "spotify",

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

leaveOnEmpty: true,
leaveOnEndCooldown: 1000,
leaveOnEmptyCooldown: 1000,

@@ -179,5 +180,3 @@ autoSelfDeaf: true,

if (!this.tracks.length && this.repeatMode === types_1.QueueRepeatMode.OFF) {
if (this.options.leaveOnEnd)
this.destroy();
this.player.emit("queueEnd", this);
this.emitEnd();
}

@@ -199,2 +198,21 @@ else if (!this.tracks.length && this.repeatMode === types_1.QueueRepeatMode.AUTOPLAY) {

}
emitEnd() {
const timeout = setTimeout(() => {
if (!this.player.queues.has(this.guild.id))
return;
if (this.tracks.length || this.current)
return;
if (this.options.leaveOnEnd)
this.destroy();
this.player.emit("queueEnd", this);
}, this.options.leaveOnEndCooldown || 0).unref();
this._cooldownsTimeout.set(`queueEnd_${this.guild.id}`, timeout);
}
refreshEndCooldown() {
const existingTimeout = this._cooldownsTimeout.get(`queueEnd_${this.guild.id}`);
if (this.tracks.length || this.current) {
clearTimeout(existingTimeout);
this._cooldownsTimeout.delete(`queueEnd_${this.guild.id}`);
}
}
/**

@@ -240,2 +258,3 @@ * Destroys this queue

this.tracks.push(track);
this.refreshEndCooldown();
this.player.emit("trackAdd", this, track);

@@ -253,2 +272,3 @@ }

this.tracks.push(...tracks);
this.refreshEndCooldown();
this.player.emit("tracksAdd", this, tracks);

@@ -638,3 +658,5 @@ }

.then((res) => res[0].url)
.catch(() => null);
.catch(() => {
/* void */
});
spotifyResolved = true;

@@ -698,5 +720,3 @@ }

if (!track || ![track.source, track.raw?.source].includes("youtube")) {
if (this.options.leaveOnEnd)
this.destroy();
return void this.player.emit("queueEnd", this);
return this.emitEnd();
}

@@ -712,5 +732,3 @@ let info = await youtube_sr_1.default.getVideo(track.url)

if (!info) {
if (this.options.leaveOnEnd)
this.destroy();
return void this.player.emit("queueEnd", this);
return this.emitEnd();
}

@@ -717,0 +735,0 @@ const nextTrack = new Track_1.default(this.player, {

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

const soundcloud_scraper_1 = require("soundcloud-scraper");
// scary things below *sigh*
// #region scary things below *sigh*
const spotifySongRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/;

@@ -19,3 +19,3 @@ const spotifyPlaylistRegex = /https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:playlist\/|\?uri=spotify:playlist:)((\w|-){22})/;

const attachmentRegex = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/;
// scary things above *sigh*
// #endregion scary things above *sigh*
class QueryResolver {

@@ -22,0 +22,0 @@ /**

@@ -48,2 +48,4 @@ "use strict";

static parseMS(milliseconds) {
if (isNaN(milliseconds))
milliseconds = 0;
const round = milliseconds > 0 ? Math.floor : Math.ceil;

@@ -50,0 +52,0 @@ return {

{
"name": "discord-player",
"version": "5.3.1",
"version": "5.3.2-dev.0",
"description": "Complete framework to facilitate music commands using discord.js",

@@ -70,9 +70,11 @@ "main": "dist/index.js",

"libsodium-wrappers": "^0.7.10",
"soundcloud-scraper": "^5.0.3",
"spotify-url-info": "^3.1.2",
"tiny-typed-emitter": "^2.1.0",
"tslib": "^2.4.0",
"youtube-sr": "^4.3.0",
"ytdl-core": "^4.11.0"
"tslib": "^2.4.0"
},
"peerDependencies": {
"soundcloud-scraper": "5.x",
"spotify-url-info": "3.x",
"youtube-sr": "4.x",
"ytdl-core": "4.x"
},
"devDependencies": {

@@ -93,6 +95,10 @@ "@discordjs/ts-docgen": "^0.4.1",

"rimraf": "^3.0.2",
"soundcloud-scraper": "^5.0.3",
"spotify-url-info": "^3.1.7",
"ts-node": "^10.9.1",
"typedoc": "^0.23.10",
"typescript": "^4.7.4"
"typescript": "^4.7.4",
"youtube-sr": "^4.3.4",
"ytdl-core": "^4.11.2"
}
}
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