ZerioDev / Music-bot

A complete code to download for a cool Discord music bot !
https://discord.gg/5cGSYV8ZZj
GNU General Public License v3.0
881 stars 1.08k forks source link

Lyrics error because of Cloudflare captcha #271

Closed Alphaegen closed 9 months ago

Alphaegen commented 1 year ago

This occurs when running the bot on hosts that are commonly blocked by Genius or Cloudflare. The try catch block doesn't prevent the error.

See issue here: https://github.com/zyrouge/node-genius-lyrics/issues/41


      throw er; // Unhandled 'error' event
      ^

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at SongsClient.<anonymous> (/home/server/ngmusicbot_test/node_modules/genius-lyrics/dist/songs/client.js:47:37)
    at Generator.next (<anonymous>)
    at fulfilled (/home/server/ngmusicbot_test/node_modules/genius-lyrics/dist/songs/client.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
zyrouge commented 1 year ago

I cannot help without code.

Alphaegen commented 1 year ago

I already fixed it with a try/catch block in this pull request. #272