Hey everyone, I’m having trouble with my Discord bot. I’m trying to make it join a voice channel, but I keep getting an error that says FFMPEG not found
. It’s driving me crazy!\n\nHere’s a bit of my code:\n\njavascript\nbot.on('message', msg => {\n if (msg.guild && msg.content === '!joinvoice') {\n if (msg.member.voice.channel) {\n msg.member.voice.channel.join()\n .then(conn => {\n msg.reply('Joined your voice channel!');\n })\n .catch(err => console.error(err));\n } else {\n msg.reply('You gotta be in a voice channel first!');\n }\n }\n});\n
\n\nI’ve got ffmpeg
in my package.json dependencies, but it’s still not working. Any ideas what I might be doing wrong? I’m pretty new to this, so I’m probably missing something obvious. Thanks for any help!
hey there! had the same issue. make sure ffmpeg is actually installed on ur system, not just in package.json. try running ‘ffmpeg -version’ in terminal. if it’s not recognized, u need to install it globally. on windows, use chocolatey or download from ffmpeg site. good luck!
Hey TomDream42, I feel your pain! I went through a similar headache when setting up my first Discord bot. Here’s what worked for me:
First, make sure you’ve got the @discordjs/opus package installed. It’s crucial for voice functionality. Run ‘npm install @discordjs/opus’ if you haven’t already.
Next, double-check that you’ve got the ffmpeg-static package. It provides a static ffmpeg build that works across platforms. Install it with ‘npm install ffmpeg-static’.
If you’ve done all that and you’re still getting the ‘FFMPEG not found’ error, try adding this line at the top of your bot file:
const ffmpeg = require(‘ffmpeg-static’);
This explicitly tells your bot where to find FFMPEG. It solved the issue for me when nothing else worked.
Hope this helps! Let us know if you get it sorted.
I encountered a similar issue when setting up my Discord bot. The problem likely stems from FFMPEG not being in your system’s PATH. Even if it’s listed in package.json, the bot needs to locate the executable on your machine.
To resolve this, try installing FFMPEG globally on your system. For macOS, you can use Homebrew with ‘brew install ffmpeg’. On Linux, use your package manager (e.g., ‘sudo apt-get install ffmpeg’ for Ubuntu).
After installation, restart your development environment and bot. If issues persist, you might need to specify the FFMPEG path in your bot’s configuration. Check the documentation of the library you’re using for voice functionality for more details on this.