Closed AlexGama11 closed 4 years ago
I am currently struggling to reproduce your error. Are you sure that you have the newest version of the repository and that you have all the necessary tools like FFMPEG installed?
git pull origin master
You can also try to update the ytdl-core dependency, which might help.
npm install ytdl-core@latest
I actually have this issue too. Though I didn't pull from master, I manually recreated everything "basically", so I know I am edge case(joy I know lol). However, I did recreate everything you have all the files in the three main folders(commands, client, and util). I built the index.js around yours. and of course my config file is custom. Here is the console error for reference. And note, that I haven't done much troubleshooting yet, as I just came to this error, when I saw this post.
TypeError: Cannot read property 'get' of undefined
at Object.execute (D:\Mercybot\commands\play.js:11:48)
at Client.
Best, The Support Hero ♥
After a bit of playing I did find the issue.
I would suggest OP look at the beginning of the index.js. I was missing "const client = new Client();" Well, it's not that I was missing it, just different from earlier work.
Hope this helps! ♥
I manually recreated the bot and I have a similar Problem. It seems that I am missing something. When hosting over "Repl.it" it gives me this ERROR when using "play" in my discord-server:
(node:342) UnhandledPromiseRejectionWarning: ReferenceError: queue is not defined (node:342) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error origin ated 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:342) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In th e future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. { Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds. at VoiceConnection.authenticateFailed (/home/runner/Test-2/node_modules/discord.js/src/ client/voice/VoiceConnection.js:304:26) at connectTimeout.client.setTimeout (/home/runner/Test-2/node_modules/discord.js/src/cl ient/voice/VoiceConnection.js:325:61) at Timeout.setTimeout (/home/runner/Test-2/node_modules/discord.js/src/client/BaseClien t.js:83:7) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) [Symbol(code)]: 'VOICE_CONNECTION_TIMEOUT' } (node:342) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message at RequestHandler.execute (/home/runner/Test-2/node_modules/discord.js/src/rest/Request Handler.js:170:25) at process._tickCallback (internal/process/next_tick.js:68:7) (node:342) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error origin ated 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: 2)
I hope it's not off-topic
Edit: But the Bot is visually joining the channel
Yes, thats because the script(s) run up to that point, which means it will carry out all the functions that are before it. Including joining the voice channel.
Can you dump the contents of your index.js file for me?
I tried play too, but on my side I get the Error: FFmpeg/avconv not found!
at Function.getInfo (D:\bots\skip2\discord-bot-master\node_modules\prism-media\src\core\FFmpeg.js:130:11)
at Function.create (D:\bots\skip2\discord-bot-master\node_modules\prism-media\src\core\FFmpeg.js:143:38)
at new FFmpeg (D:\bots\skip2\discord-bot-master\node_modules\prism-media\src\core\FFmpeg.js:44:27)
at AudioPlayer.playUnknown (D:\bots\skip2\discord-bot-master\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
at VoiceConnection.play (D:\bots\skip2\discord-bot-master\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
at Object.play (D:\bots\skip2\discord-bot-master\commands\play.js:78:8)
at Object.execute (D:\bots\skip2\discord-bot-master\commands\play.js:48:16)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17248) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (D:\bots\skip2\discord-bot-master\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17248) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17248) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
does someone have an Idea how to solve the problem?
@AniFan1 Did you install FFMPEG?
@thesupporthero yes I did
even after updating ytdl-core it still didn't work, and after trying thesupporthero's solution it still didn't work, especially since my script doesn't work with the line "const client = new Client();" replacing "const client = new Discord.Client();" here's the error message i get:
TypeError: Cannot read property 'get' of undefined
at Object.execute (C:\Users\HP\Desktop\Rei\commands\Play.js:11:48)
at Client.
Seemingly, I am having this same issue.
Whenever I try to add a song with play command, it shows me this.
Cannot read property 'get' of undefined
When I inspected the code more preciously, I came across this line of code which is causing this, in the play
command.
const serverQueue = message.client.queue.get(message.guild.id);
As of now, I don't know a fix of this thing, cause this is my first time working with discord music.
Edit: I am not using the whole source provided. Rather I am using those play, skip, nowPlaying, and the stop commands. I have my bot hosted on glitch, with the commands file in the commands folder.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
I too have the same issue
Describe the bug the play command doesn't seem to be working for me, while it was working before
To Reproduce Steps to reproduce the behavior: Try the play command
Expected behavior I expected it to play music, like it did before
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):