jericho-player
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "jericho-player", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "LightWeight Framework for discord.js v13 Music Bots and Radio Bots with fast moderation with commands and no memory leak", | ||
@@ -34,3 +34,3 @@ "main": "./src/index.js", | ||
"eslint": "^8.2.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.25.2", | ||
@@ -56,3 +56,3 @@ "jsdoc": "^3.6.7", | ||
"is-url": "^1.2.4", | ||
"playdl-music-extractor": "^2.3.5", | ||
"playdl-music-extractor": "^2.3.7", | ||
"prism-media": "^1.3.2", | ||
@@ -73,3 +73,3 @@ "youtube-suggest-gen": "^1.0.1" | ||
}, | ||
"homepage": "https://jericho-player.js.org/", | ||
"homepage": "https://jericho-player.js.org", | ||
"keywords": [ | ||
@@ -76,0 +76,0 @@ "jericho-player", |
@@ -89,7 +89,7 @@ const EventEmitter = require('events'); | ||
/* | ||
* - QueueInstance Fetched from Private Raw Cache Fetching Method "Player.QueueCacheFetch(guildId)" | ||
* - QueueInstance Fetched from Private Raw Cache Fetching Method "Player.#QueueCacheFetch(guildId)" | ||
* - QueueIntance => will be used to filter Voice Events Related to our Queue or else return undefined for handling | ||
*/ | ||
const QueueInstance = Player.QueueCacheFetch( | ||
const QueueInstance = Player.#QueueCacheFetch( | ||
(NewVoiceState ? NewVoiceState.guild.id : undefined) | ||
@@ -252,5 +252,5 @@ ?? (OldVoiceState ? OldVoiceState.guild.id : undefined), | ||
// To Avoid excess use of memory and Space in Large bots , We will always Cache Queue and Create one if is Deleted by DeleteQueue() method | ||
const QueueInstance = Player.QueueCacheFetch(message.guild.id, QueueCreateOptions) | ||
const QueueInstance = Player.#QueueCacheFetch(message.guild.id, QueueCreateOptions) | ||
?? new Queue(this.Client, message, QueueCreateOptions, this); | ||
return Player.QueueCacheAdd(QueueInstance); | ||
return Player.#QueueCacheAdd(QueueInstance); | ||
} | ||
@@ -272,4 +272,4 @@ | ||
// Checks for Queue in Cache doesn't matter if its Connection was destroyed | Cache only fetch its Existence to avoid excess CPU load | ||
if (Player.QueueCacheFetch(guildId)) { | ||
return void Player.QueueCacheRemove(guildId); | ||
if (Player.#QueueCacheFetch(guildId)) { | ||
return void Player.#QueueCacheRemove(guildId); | ||
} | ||
@@ -291,3 +291,3 @@ return void this.emit('error', 'Destroyed Queue', undefined); | ||
} | ||
return Player.QueueCacheFetch(guildId); | ||
return Player.#QueueCacheFetch(guildId); | ||
} | ||
@@ -297,3 +297,3 @@ | ||
* @private Player Class Defined Method | ||
* QueueCacheAdd -> Private Method for Player's Workload to Add Queue Cache Easily without using any Player's Instance | ||
* #QueueCacheAdd -> Private Method for Player's Workload to Add Queue Cache Easily without using any Player's Instance | ||
* @param {Queue} QueueInstance Queue Instance made from "Queue" class to work around with many <Queue>.methods() for a guild | ||
@@ -303,3 +303,3 @@ * @returns {Queue} QueueInstance , To reperesnt the Work Complete Signal | ||
static QueueCacheAdd(QueueInstance) { | ||
static #QueueCacheAdd(QueueInstance) { | ||
Player.#QueueCaches[`${QueueInstance.guildId}`] = QueueInstance; | ||
@@ -311,3 +311,3 @@ return QueueInstance; | ||
* @private Player Class Defined Method | ||
* QueueCacheFetch -> Private Method for Player's Workload to Fetch Queue Cache Easily without using any Player's Instance | ||
* #QueueCacheFetch -> Private Method for Player's Workload to Fetch Queue Cache Easily without using any Player's Instance | ||
* @param {String|Number} guildId Guild["id"] OR guild.id is required to fetch queue from the Cache | ||
@@ -318,3 +318,3 @@ * @param {DefaultQueueCreateOptions} QueueCreateOptions QueueCreateOptions for if Queue "connection" is destroyed , then it requires Options to remake whole infrastructure | ||
static QueueCacheFetch(guildId, QueueCreateOptions = null) { | ||
static #QueueCacheFetch(guildId, QueueCreateOptions = null) { | ||
const QueueInstance = Player.#QueueCaches[`${guildId}`]; | ||
@@ -326,3 +326,3 @@ if (QueueCreateOptions && QueueInstance) { | ||
); | ||
if (typeof QueueInstance.destroyed !== 'boolean') clearTimeout(QueueInstance.destroyed); | ||
if (QueueInstance && QueueInstance.destroyed && typeof QueueInstance.destroyed !== 'boolean') clearTimeout(QueueInstance.destroyed); | ||
QueueInstance.destroyed = false; | ||
@@ -336,3 +336,3 @@ Player.#QueueCaches[`${guildId}`] = QueueInstance; | ||
* Player Class Defined Method | ||
* QueueCacheRemove -> Private Method for Player's Workload to Remove Queue Cache Easily without using any Player's Instance | ||
* #QueueCacheRemove -> Private Method for Player's Workload to Remove Queue Cache Easily without using any Player's Instance | ||
* @param {String|Number} guildId Guild["id"] OR guild.id is required to fetch queue from the Cache | ||
@@ -343,5 +343,5 @@ * @returns {void} undefined , To reperesnt the Work Complete Signal as Queue will be destroyed so , we can't return Queue | ||
static QueueCacheRemove(guildId) { | ||
if (!this.QueueCacheFetch(guildId)) return false; | ||
const QueueInstance = Player.#QueueCaches[`${guildId}`]; | ||
static #QueueCacheRemove(guildId) { | ||
if (!this.#QueueCacheFetch(guildId)) return false; | ||
let QueueInstance = Player.#QueueCaches[`${guildId}`]; | ||
if (Player.#QueueCaches[`${guildId}`].playing) { | ||
@@ -353,4 +353,5 @@ Player.#QueueCaches[`${guildId}`].stop(); | ||
Garbage.Structure = QueueInstance; | ||
QueueInstance = null; | ||
Player.#QueueCaches[`${guildId}`] = null; | ||
delete Garbage.Structure; | ||
Player.#QueueCaches[`${guildId}`] = undefined; | ||
return void null; | ||
@@ -408,3 +409,3 @@ } | ||
* @param {VoiceChannel|StageChannel} VoiceChannel Simple Discord Voice Channel | Stage Channel Value | ||
* @returns {void} undefined, As these Private method only meant for Voice Handling with Options | ||
* @returns {Promise<void>} undefined, As these Private method only meant for Voice Handling with Options | ||
* @private | ||
@@ -411,0 +412,0 @@ */ |
@@ -517,5 +517,5 @@ const { | ||
const Garbage = {}; | ||
this.StreamPacket = null; | ||
Garbage.container = this.StreamPacket; | ||
delete Garbage.container; | ||
this.StreamPacket = undefined; | ||
return this.destroyed ?? undefined; | ||
@@ -522,0 +522,0 @@ } |
@@ -69,3 +69,3 @@ const ClassUtils = require('../Utilities/ClassUtils'); | ||
} | ||
const RawData = await TrackGenerator.SongsFetching( | ||
const RawData = await TrackGenerator.#SongsFetching( | ||
Query, | ||
@@ -92,3 +92,3 @@ FetchOptions, | ||
} | ||
const Chunks = TrackGenerator.Track_Id_Placement( | ||
const Chunks = TrackGenerator.#Track_Id_Placement( | ||
RawData.tracks, | ||
@@ -107,3 +107,3 @@ CacheLength, | ||
/** | ||
* @private Track_Id_Placement -> Track Placement in Tracks Cache with Differing as stream tracks and normal tracks for users | ||
* @private #Track_Id_Placement -> Track Placement in Tracks Cache with Differing as stream tracks and normal tracks for users | ||
* @param {DefaultStream[]} Tracks Stream Tracks to be converted User fetchable | ||
@@ -115,3 +115,3 @@ * @param {Number|void} CacheLength last Cached Track's ID | ||
static Track_Id_Placement(Tracks, CacheLength, requestedBy = undefined) { | ||
static #Track_Id_Placement(Tracks, CacheLength, requestedBy = undefined) { | ||
const StreamDatas = []; | ||
@@ -123,3 +123,3 @@ const SearchTracks = []; | ||
? SearchTracks.push( | ||
TrackGenerator.UserTrackModelGen(Tracks[count], requestedBy), | ||
TrackGenerator.#UserTrackModelGen(Tracks[count], requestedBy), | ||
) | ||
@@ -136,3 +136,3 @@ : undefined; | ||
/** | ||
* SongsFetching() -> Raw Track Data Fetching from various extractors like "play-dl" | "youtube-dl" | ||
* @private #SongsFetching() -> Raw Track Data Fetching from various extractors like "play-dl" | "youtube-dl" | ||
* @param {String} Query Query like URls or Youtube Searches | Default Extractor accept 5 supported and big websites like youtube , spotify , soundcloud , retribution , facebook and for "youtube-dl" , it accept any follows official "youtube" searches | ||
@@ -144,3 +144,3 @@ * @param {DefaultFetchOptions} FetchOptions Fetching Options for Extractors | ||
static async SongsFetching( | ||
static async #SongsFetching( | ||
Query, | ||
@@ -164,3 +164,3 @@ FetchOptions = { | ||
&& ClassUtils.ScanDeps('video-extractor') | ||
? await TrackGenerator.YoutubeDLExtractor( | ||
? await TrackGenerator.#YoutubeDLExtractor( | ||
Query, | ||
@@ -175,3 +175,3 @@ FetchOptions.ExtractorStreamOptions, | ||
? ClassUtils.ScanDeps('playdl-music-extractor') | ||
? await TrackGenerator.PlayDLExtractor( | ||
? await TrackGenerator.#PlayDLExtractor( | ||
Query, | ||
@@ -187,3 +187,3 @@ FetchOptions.ExtractorStreamOptions, | ||
? ClassUtils.ScanDeps('video-extractor') | ||
? await TrackGenerator.YoutubeDLExtractor( | ||
? await TrackGenerator.#YoutubeDLExtractor( | ||
Query, | ||
@@ -199,3 +199,3 @@ FetchOptions.ExtractorStreamOptions, | ||
/** | ||
* @private YoutubeDLExtractor -> Youtube-Dl Extractor for player | ||
* @private #YoutubeDLExtractor -> Youtube-Dl Extractor for player | ||
* @param {String} Query Query like URls or Youtube Searches | Default Extractor accept 5 supported and big websites like youtube , spotify , soundcloud , retribution , facebook and for "youtube-dl" , it accept any follows official "youtube" searches | ||
@@ -207,3 +207,3 @@ * @param {DefaultExtractorStreamOptions} ExtractorStreamOptions Extractor Fetching Options | ||
static async YoutubeDLExtractor(Query, ExtractorStreamOptions, NoStreamif) { | ||
static async #YoutubeDLExtractor(Query, ExtractorStreamOptions, NoStreamif) { | ||
const { StreamDownloader, Extractor } = require('video-extractor'); | ||
@@ -236,3 +236,3 @@ if (NoStreamif) { | ||
/** | ||
* @private PlayDLExtractor -> Play-Dl Extractor for player | ||
* @private #PlayDLExtractor -> Play-Dl Extractor for player | ||
* @param {String} Query Query like URls or Youtube Searches | Default Extractor accept 5 supported and big websites like youtube , spotify , soundcloud , retribution , facebook and for "youtube-dl" , it accept any follows official "youtube" searches | ||
@@ -244,3 +244,3 @@ * @param {DefaultExtractorStreamOptions} ExtractorStreamOptions Extractor Fetching Options | ||
static async PlayDLExtractor(Query, ExtractorStreamOptions, NoStreamif) { | ||
static async #PlayDLExtractor(Query, ExtractorStreamOptions, NoStreamif) { | ||
const { StreamDownloader, Extractor } = require('playdl-music-extractor'); | ||
@@ -254,3 +254,3 @@ if (NoStreamif) { | ||
/** | ||
* @private UserTrackModelGen -> Transfering Normal Stream Data to user readable Track | ||
* @private #UserTrackModelGen -> Transfering Normal Stream Data to user readable Track | ||
* @param {DefaultStream} TrackData Stream Data about the Track | ||
@@ -261,3 +261,3 @@ * @param {User|GuildMember|void} requestedByUser Requested user for Track Object | ||
static UserTrackModelGen(TrackData, requestedByUser) { | ||
static #UserTrackModelGen(TrackData, requestedByUser) { | ||
return { | ||
@@ -264,0 +264,0 @@ Id: TrackData.Id, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134171
3699