My bot doesn't play any sound, he has permission to speak and the intents

My bot doesn't play any sound, he has permission to speak and the intents
const { joinVoiceChannel, createAudioResource, createAudioPlayer } = require('@discordjs/voice');

const voice = require("@discordjs/voice");

client.on('voiceStateUpdate', async (oldState, newState) => {
// use the .channelID property (.voice doesn't exist)
//const newUserChannel = newState.channelID;
//const textChannel = client.channels.cache.get('1135536647627354153');

if(client.users.cache.get(oldState.id).bot) return;

if(newState.channelId === '1129499028317544549') {

let username = client.users.cache.get(oldState.id).username;

//join

joinVoiceChannel({
channelId: '1129499028317544549',
guildId: newState.guild.id,
adapterCreator: newState.guild.voiceAdapterCreator
})

client.channels.cache.get("1135536647627354153").send('Working')

//Play

const resource = voice.createAudioResource(__dirname, 'res/audio.mp3')
const player = createAudioPlayer();
player.play(resource);

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

const voice = require("@discordjs/voice");

client.on('voiceStateUpdate', async (oldState, newState) => {
// use the .channelID property (.voice doesn't exist)
//const newUserChannel = newState.channelID;
//const textChannel = client.channels.cache.get('1135536647627354153');

if(client.users.cache.get(oldState.id).bot) return;

if(newState.channelId === '1129499028317544549') {

let username = client.users.cache.get(oldState.id).username;

//join

joinVoiceChannel({
channelId: '1129499028317544549',
guildId: newState.guild.id,
adapterCreator: newState.guild.voiceAdapterCreator
})

client.channels.cache.get("1135536647627354153").send('Working')

//Play

const resource = voice.createAudioResource(__dirname, 'res/audio.mp3')
const player = createAudioPlayer();
player.play(resource);

}
});
7 Replies
d.js toolkit
d.js toolkit15mo 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
ShompiFlen
ShompiFlen15mo ago
Take a read on this post from like an hour ago -> https://discord.com/channels/222078108977594368/1150902545443729439 if you have everything and this still doesn't work ping me here
Mjicio_
Mjicio_OP15mo ago
Still doesn't work
ShompiFlen
ShompiFlen15mo ago
okay what have you tried show me your package.json file
Mjicio_
Mjicio_OP15mo ago
Mjicio_
Mjicio_OP15mo ago
@ShompiFlen I FIX IDK HOW
ShompiFlen
ShompiFlen15mo ago
great
Want results from more Discord servers?
Add your server