From 0aef286b69a46101d3219f3ea999948a9f1bc013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FAY=E3=82=B7?= <103030954+FAYStarNext@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:57:51 +0700 Subject: [PATCH 1/3] chore: Update npm dependencies and Babel configuration --- package.json | 12 ++++++------ src/structures/Player.ts | 17 +++++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 5163252..b3c635a 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ "test:player": "bun test/player.ts" }, "devDependencies": { - "@eslint/js": "^9.7.0", + "@eslint/js": "^9.8.0", "@types/bun": "latest", - "eslint": "^9.7.0", - "globals": "^15.8.0", - "typescript-eslint": "^7.17.0", + "eslint": "^9.8.0", + "globals": "^15.9.0", + "typescript-eslint": "^7.18.0", "@babel/cli": "^7.24.8", - "@babel/core": "^7.24.9", - "@babel/preset-env": "^7.24.8", + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.3", "@babel/preset-typescript": "^7.24.7" }, "publishConfig": { diff --git a/src/structures/Player.ts b/src/structures/Player.ts index c3da295..31f1aa8 100644 --- a/src/structures/Player.ts +++ b/src/structures/Player.ts @@ -3,7 +3,6 @@ import { Manager, SearchQuery, SearchResult } from "./Manager"; import { Node } from "./Node"; import { Queue } from "./Queue"; import { Sizes, State, Structure, TrackSourceName, TrackUtils, VoiceState } from "./Utils"; -import * as _ from "lodash"; import playerCheck from "../utils/playerCheck"; import { ClientUser, Message, User } from "discord.js"; @@ -235,8 +234,8 @@ export class Player { const finalOptions = playOptions ? playOptions : ["startTime", "endTime", "noReplace"].every((v) => Object.keys(optionsOrTrack || {}).includes(v)) - ? (optionsOrTrack as PlayOptions) - : {}; + ? (optionsOrTrack as PlayOptions) + : {}; if (TrackUtils.isUnresolvedTrack(this.queue.current)) { try { @@ -343,7 +342,6 @@ export class Player { this.manager.emit("PlayerStateUpdate", oldPlayer, this); return this; } - /** * Sets the queue to repeat and shuffles the queue after each song. * @param repeat "true" or "false". @@ -364,10 +362,17 @@ export class Player { this.trackRepeat = false; this.queueRepeat = false; this.dynamicRepeat = true; - + function shuffleArray(array: Queue): Queue[] { + // Shuffle the array + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } + return [array]; + } this.dynamicLoopInterval = setInterval(() => { if (!this.dynamicRepeat) return; - const shuffled = _.shuffle(this.queue); + const shuffled = shuffleArray(this.queue); this.queue.clear(); shuffled.forEach((track) => { this.queue.add(track); From 28ab4539f2d14193b15b6d2ed808315d666ae28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FAY=E3=82=B7?= <103030954+FAYStarNext@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:58:32 +0700 Subject: [PATCH 2/3] chore: Bump package.json version to 1.0.15-indev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b3c635a..4969760 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sunday.ts", "main": "dist/index.js", "types": "dist/index.d.ts", - "version": "1.0.14-indev", + "version": "1.0.15-indev", "description": "Sunday a lavalink wrapper", "license": "MIT", "author": "FAYStarNext", From 5b868008e37896973c8d14df64dbb9cd8923634a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FAY=E3=82=B7?= <103030954+FAYStarNext@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:59:18 +0700 Subject: [PATCH 3/3] chore: Update npm dependencies and Babel configuration --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4969760..5cb3f6c 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ "test:player": "bun test/player.ts" }, "devDependencies": { - "@eslint/js": "^9.8.0", + "@eslint/js": "^9.7.0", "@types/bun": "latest", - "eslint": "^9.8.0", - "globals": "^15.9.0", - "typescript-eslint": "^7.18.0", + "eslint": "^9.7.0", + "globals": "^15.8.0", + "typescript-eslint": "^8.0.0", "@babel/cli": "^7.24.8", - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.3", + "@babel/core": "^7.24.9", + "@babel/preset-env": "^7.24.8", "@babel/preset-typescript": "^7.24.7" }, "publishConfig": { @@ -48,4 +48,4 @@ "wrapper", "api" ] -} +} \ No newline at end of file