Answer the question
In order to leave comments, you need to log in
Error (ReferenceError: connection is not defined) what should I do?
I'm writing code that should play music when.
I created a variable:
const dispatcher = connection.playFile('./Pedrina y Rio - Enamorada.mp3'); which should play an mp3 file, but gives an error that "connection" is not defined
Here is the code:
const dispatcher = connection.playFile('./Pedrina y Rio - Enamorada.mp3');
dispatcher.on('end', () => {
});
dispatcher.on('error', e => {
console.log(e);
});
const dispatcher = connection.playFile('./Pedrina y Rio - Enamorada.mp3');
^
ReferenceError: connection is not defined
at Object.<anonymous> (Z:\bot\bot.js:52:20)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
at internal/main/run_main_module.js:17:11
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question