© 2026 Hedgehog Software, LLC
const { joinVoiceChannel } = require('@discordjs/voice'); let channel = '1107089389345067008'; joinVoiceChannel({ channelId: channel, guildId: interaction.guild.id, adapterCreator: interaction.guild.voiceAdapterCreator, }) const { createReadStream } = require('node:fs'); const { join } = require('node:path'); const { createAudioResource, StreamType, createAudioPlayer } = require('@discordjs/voice'); // Basic, default options are: // Input type is unknown, so will use FFmpeg to convert to Opus under-the-hood // Inline volume is opt-in to improve performance const player = createAudioPlayer(); // An AudioPlayer will always emit an "error" event with a .resource property player.on('error', error => { console.error('Error:', error.message, 'with track', error.resource.metadata.title); }); const resource = createAudioResource('../../../playlist/Josh_Rubin_Surrender_NCS_Release.mp3', { metadata: { title: 'A good song!', }, }); player.play(resource);
Join the Discord to ask follow-up questions and connect with the community
Support server for discord.js, a Node.js module to interact with Discord's apps API.
57,666 Members