diff --git a/package.json b/package.json index 6d67434..795b025 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-player", - "version": "5.3.0", + "version": "5.3.1", "description": "Complete framework to facilitate music commands using discord.js", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -18,7 +18,7 @@ "./dist/*": "./dist/*" }, "scripts": { - "dev": "cd example/test && ts-node index.ts", + "dev": "cd examples/test && ts-node index.ts", "build": "rimraf dist && tsc && npm run build:esm", "build:check": "tsc --noEmit --incremental false", "prepublishOnly": "rollup-type-bundler -e stream", diff --git a/src/Structures/Queue.ts b/src/Structures/Queue.ts index 52a6802..bf39f4a 100644 --- a/src/Structures/Queue.ts +++ b/src/Structures/Queue.ts @@ -455,16 +455,13 @@ class Queue { */ shuffle() { if (this.#watchDestroyed()) return; - if (!this.tracks.length || this.tracks.length < 3) return false; - const currentTrack = this.tracks.shift(); + if (!this.tracks.length || this.tracks.length < 2) return false; 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; } diff --git a/src/utils/AudioFilters.ts b/src/utils/AudioFilters.ts index ee06e7f..b377064 100644 --- a/src/utils/AudioFilters.ts +++ b/src/utils/AudioFilters.ts @@ -54,18 +54,18 @@ class AudioFilters { } public static *[Symbol.iterator](): IterableIterator<{ name: FiltersName; value: string }> { - for (const [k, v] of Object.entries(this)) { - if (typeof this.filters[k as FiltersName] === "string") yield { name: k as FiltersName, value: v as string }; + for (const [k, v] of Object.entries(this.filters)) { + yield { name: k as FiltersName, value: v as string }; } } public static get names() { - return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this.filters[p as FiltersName] !== "function") as FiltersName[]; + return Object.keys(this.filters) as FiltersName[]; } // @ts-expect-error AudioFilters.length public static get length() { - return Object.keys(this).filter((p) => !["names", "length"].includes(p) && typeof this.filters[p as FiltersName] !== "function").length; + return this.names.length; } public static toString() { @@ -77,7 +77,7 @@ class AudioFilters { * @param filter The filter name * @returns */ - public static create(filters?: FiltersName[]) { + public static create(filters?: K[]) { if (!filters || !Array.isArray(filters)) return this.toString(); return filters .filter((predicate) => typeof predicate === "string")