import { StreamType, AudioPlayerStatus, createAudioResource, entersState, } from '@discordjs/voice'; function playSong(url, player) { const resource = createAudioResource(url, { inputType: StreamType.Arbitrary, }); player.play(resource); return entersState(player, AudioPlayerStatus.Playing, 5e3); } export default { async command (interaction, connection, player) { await connection.subscribe(player); await playSong('https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3', player); interaction.reply('Playing song', {ephemeral: true}) }, }; // in other file import { createAudioPlayer } from '@discordjs/voice'; const player = createAudioPlayer(); export default player;