Tomato6966 / lavalink-client

Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.
https://tomato6966.github.io/lavalink-client/
MIT License
48 stars 13 forks source link

Error when you use the sponsor blocker #18

Closed zoli456 closed 9 months ago

zoli456 commented 9 months ago

It throw an error if you use the setSponsorBlock(). It enable the skipping but it show this message in logs:

  SyntaxError: Unexpected end of JSON input

  - JSON.parse

  - readable.js:276 consumeEnd
    [container]/[undici]/lib/api/readable.js:276:20

  - readable.js:258 BodyReadable.<anonymous>
    [container]/[undici]/lib/api/readable.js:258:7

  - node:events:514 BodyReadable.emit
    node:events:514:28

  - readable.js:73 BodyReadable.emit
    [container]/[undici]/lib/api/readable.js:73:18

  - readable:1589 endReadableNT
    node:internal/streams/readable:1589:12

  - task_queues:82 process.processTicksAndRejections
    node:internal/process/task_queues:82:21
Tomato6966 commented 9 months ago

can you show me how you call the function.

zoli456 commented 9 months ago
    let sponsor_blocker = options.getString("sponsor_blocker", false);
    if (sponsor_blocker) {
      if (sponsor_blocker === "true") player.setSponsorBlock();
      else {
        player.deleteSponsorBlock();
      }
    }
Tomato6966 commented 9 months ago

Oh it's because it's a put request and they don't return responses like json, therefore no json fetching is required. thanks for the report, i theoretically fixed it could you test it with the new github version npm i tomato6966/lavalink-client thanks

zoli456 commented 9 months ago

Thank you for the help. It works now.

Tomato6966 commented 9 months ago

Yw it's now available under the v2.0.1 npm-release