I want my bot to join the voice channel where the commanding person is located and say something then leave, I tried to do this but I failed. The bot joins the sound channel but does not say anything. How can I do that?
Codes:
client.on('message', async message => {
if (!message.guild) return;
if (message.content.toLowerCase() === prefix + "bruh" ) {
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
} else {
message.reply('First of all you have to join an audio channel !');
const ytdl = require('ytdl-core');
connection.play(ytdl('https://www.youtube.com/watch?v=2ZIpFytCSVc', { filter: 'audioonly' }));
}
}
});