From cbc89fb273f48e19602fb39cf69f4df97b06d675 Mon Sep 17 00:00:00 2001 From: FAYStarNext Date: Sat, 24 Aug 2024 16:13:12 +0000 Subject: [PATCH 1/2] Refactor REST class to use response.json() for parsing JSON --- package.json | 1 - src/structures/Rest.ts | 2 +- test/player.ts | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e575b32..417e0c9 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "scripts": { "build:js": "npx babel src --out-dir dist --extensions \".ts,.tsx\" --source-maps inline", "lint": "npx eslint src/**/*.ts", - "test:connect": "bun test/connect.ts", "test:manager": "bun test/manager.ts", "test:player": "bun test/player.ts" }, diff --git a/src/structures/Rest.ts b/src/structures/Rest.ts index 17582b1..f0c0df8 100644 --- a/src/structures/Rest.ts +++ b/src/structures/Rest.ts @@ -53,7 +53,7 @@ export class Rest { }, body: JSON.stringify(body), }); - return JSON.parse(await response.text()); + return await response.json(); } catch(error) { if (error?.response?.status === 404) { this.node.destroy(); diff --git a/test/player.ts b/test/player.ts index 7f76cb8..9cc1821 100644 --- a/test/player.ts +++ b/test/player.ts @@ -18,6 +18,10 @@ let manager = new Manager({ password: 'youshallnotpass', }, ], + caches: { + enabled: true, + time: 60000, + }, clientId: "1234567890", send(guild_id, payload) { const guild = client.guilds.cache.get(guild_id); From 77ed023e689a82c7b8794269f22e92a19d38c766 Mon Sep 17 00:00:00 2001 From: FAYStarNext Date: Sat, 24 Aug 2024 16:17:14 +0000 Subject: [PATCH 2/2] chore: Bump package.json version to 1.0.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 417e0c9..7b922db 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.17", + "version": "1.0.18", "description": "Sunday a lavalink wrapper", "license": "MIT", "author": "FAYStarNext",