DarkoPendragon / discord.js-musicbot-addon

This DOES NOT WORK any more. This repo only serves as an archive for is anyone wants to pickup my work. You may still join the discord however.
https://discord.gg/4c8Rh7tWhv
ISC License
112 stars 142 forks source link

Error when requesting or searching for music #68

Closed SyedOmarNoor closed 6 years ago

SyedOmarNoor commented 6 years ago

Describe the bug When I run my bot, it show this error: _(node:4404) UnhandledPromiseRejectionWarning: Error: Error code: 403 at ClientRequest.response (C:\Users\Student\Downloads\discord music bot\node _modules\ytsearcher\lib\struct\YTSearch.js:92:23) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:544:21 ) at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17) at TLSSocket.socketOnData (_http_client.js:440:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_streamreadable.js:263:12) (node:4404) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:4404) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My index.js code:

// @ts-nocheck const Discord = require("discord.js"); // Require the Discord.js library. const token = process.env.token; //const youtubeapikeyyay = process.env.youtube-api-key //const ffmpeg = require("./ffmpeg.exe")

class Bot extends Discord.Client { constructor(options) { super(options); this.music = require("discord.js-musicbot-addon"); } } const client = new Bot();

client.music.start(client, { botPrefix: "??", youtubeKey: "AIzaSyCvCZFaboMS0n-YmT9I2aO5JnNnxgEyQOw" // Set the api key used for YouTube. });

client.login(token); // Connect the bot.

(Technically your example script.)

Do you know what is wrong?

Expected behavior I expected it to play music.

Versions

Additional context I have ffmpeg added to my PATH.

BluSpring commented 6 years ago

I believe that means your YouTube API key is invalid.

Huskydog9988 commented 6 years ago

I would recommend hiding your api key from this post.

DarkoPendragon commented 6 years ago

Yes, as Naz said its a problem with your api key not the code. Make sure its configured properly through the Google console.