example.mp3 Audio doesn't play

if (msg.content == '!t') {
const { joinVoiceChannel } = require('@discordjs/voice');

const connection = joinVoiceChannel({
channelId: msg.channel.id,
guildId: msg.channel.guild.id,
adapterCreator: msg.channel.guild.voiceAdapterCreator,
});
const { createAudioPlayer } = require('@discordjs/voice');

const player = createAudioPlayer();
const { createAudioResource } = require('@discordjs/voice');

const resource = createAudioResource('.\example.mp3');
player.play(resource);

msg.channel.send('z');
}
if (msg.content == '!t') {
const { joinVoiceChannel } = require('@discordjs/voice');

const connection = joinVoiceChannel({
channelId: msg.channel.id,
guildId: msg.channel.guild.id,
adapterCreator: msg.channel.guild.voiceAdapterCreator,
});
const { createAudioPlayer } = require('@discordjs/voice');

const player = createAudioPlayer();
const { createAudioResource } = require('@discordjs/voice');

const resource = createAudioResource('.\example.mp3');
player.play(resource);

msg.channel.send('z');
}
Bot joins voice chat, but does not play audio
3 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
wen
wen11mo ago
u sure your path to the example.mp3 is correct ?
Nilla
NillaOP11mo ago
Solved! :)
Want results from more Discord servers?
Add your server