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');
  }

Bot joins voice chat, but does not play audio
Was this page helpful?