Discord bot not playing song from an custom mp3 api url
I have this code for the command where the bot suppose to play the audio from the mp3 url which is: https://api.onlyhit.us/play
Here is code for the command: https://srcb.in/udqj0lkpDd
Currently what happens the bot joins the voice channel and keeps himself defan and doesnot play anything.
Can anyone please tell me how can I fix this issue? Thanks in Advance
Discord.js: v13.15.1
20 Replies
you were previously told to install ffmpeg
have you done so?
yes I have installed ffmpeg but I am unsure how to use it to play the url
it's already used internally by
@discordjs/voice
To debug your voice connection and player:
- Use
debug: true
when creating your VoiceConnection
and AudioPlayer
- Add an event listener to the <VoiceConnection> and the <AudioPlayer>:
- Add an error
listener to the stream you are passing to the resource:
Note: The <>
represents classes that need to be adapted to their respective name in your code
when I say I have installed ffmpeg I mean the npm package. Not the one you install from a website and setup on env. Also do you have a guide or something for discord.js to steup a basic music bot from an api url?
when I say I have installed ffmpeg I mean the npm package. Not the one you install from a website and setup on env.as long as it's detected when generating a dependency report https://discordjs.guide/voice/#debugging-dependencies
Also do you have a guide or something for discord.js to steup a basic music bot from an api url?not specifically for that, no the guide covers creating players/resources more generally https://discordjs.guide/voice/audio-player.html https://discordjs.guide/voice/audio-resources.html
hmmn the guides you provided the first one for player here I can see on the resource it passes an mp3 file but in my case I have an mp3 api url. So I am not sure how to play that. Even one time I directly tried passing the url on the resource but it joins the voice channel and stays defan and does not play anything
just to confirm, could you generate a dependency report?
how do you create that?
looks like you're missing some dependencies in the other categories
please install at least one opus encoding and encryption library
https://discordjs.guide/voice/#installation
Alright I have installed this 2
@discordjs/opus
@discordjs/voice libsodium-wrappers
now what?
This are my intents
do I need to add something here?
I mean you will want the
GUILD_VOICE_STATES
intentI have changed the code and now using this. Looks like the bot joins the voice channel as defan but does not play anything. Also on the command it says application does not reponds, no error on the console
code: https://srcb.in/wmjaX0wDtj
I gave the same input to chat gpt here is what it says
is it true?
nvm it works now