[Bug]: TypeError when playing a Youtube song with @discordx/music
See original GitHub issueWhat happened?
When playing a song with Queue.play
, nothing is played. Looking at the stacktrace, it seems like Queue.processQueue
throws an error that’s caught and it tries to emit an error, and tries to index error.resource.metadata
, but that causes an error (See below). The problem seems to be twofold: the song isn’t being played, and the error handling causes an error.
node version: 16.6.0 OS: Arch Linux (5.14.14-arch1-1)
If there is any other relevant information I should include, let me know.
Reproduction
To reproduce, paste in the bot token to bot_token
, get the bot running and run ~test
in a server while connected to a voice channel. Key file to look at are youtubePlayer.ts
Package
Version
Stable
Relevant log output
➜ BananaBotJS yarn run start
yarn run v1.22.17
$ nodemon --exec BOT_TOKEN=`cat bot_token` node --loader ts-node/esm/transpile-only src/index.ts
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `BOT_TOKEN=<omitted> node --loader ts-node/esm/transpile-only src/index.ts`
(node:2134137) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
BananaTesting >> global >> command >> adding 0 []
BananaTesting >> global >> command >> deleting 0 []
BananaTesting >> global >> command >> updating 0 []
Bot started
TypeError: Cannot read property 'metadata' of undefined
at MyQueue.processQueue (file:///home/tony/repos/BananaBotJS/node_modules/@discordx/music/src/YoutubePlayer/core/Queue.ts:272:56)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[nodemon] app crashed - waiting for file changes before starting...
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Discord.py music bot raising TypeError when a youtube link is ...
Try this out, it should work for both a YouTube song name and a YouTube URL: import asyncio import discord import youtube_dl from ......
Read more >[BUG] Some Direct link youtube videos fail to play #274 - GitHub
Use play command with <some direct link to an age restricted video> . Error will be thrown and song will fail to play;...
Read more >Rythm Discord Bot Not Working: Bug Fixed (2022) - YouTube
Rythm Discord Bot not working? Rythm not playing music ? Learn how to easily fix Rythm, and make the audio work again!
Read more >Create a Music Discord Bot using Discord JS - YouTube
Create a music bot using JavaScript, discord JS, ffmpeg, youtube -dl and discord - player. I will guide you through the entire process...
Read more >Discord JS - Playing Audio in a Voice Channel ... - YouTube
In this video we go over how to get your bot to join a voice channel and how to play an audio file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah. As far as I could tell, I didn’t see any mention of it for @discordx/music previously but I see you just added it. Thanks.
in your repo, you need to move the Player object outside slash command. check music example for more details.