ChittyKat
DIdiscord.js - Imagine ❄
•Created by ChittyKat on 12/6/2024 in #djs-voice
not playing
const voiceChannel = interaction.member?.voice.channel;
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
const player = createAudioPlayer();
const resource = createAudioResource(
path.join(__dirname, "./music/audio.mp3")
);
player.play(resource);
connection.subscribe(player);
player.on("error", (error) => {
console.error(`Audio player error: ${error.message}`);
});
const voiceChannel = interaction.member?.voice.channel;
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
const player = createAudioPlayer();
const resource = createAudioResource(
path.join(__dirname, "./music/audio.mp3")
);
player.play(resource);
connection.subscribe(player);
player.on("error", (error) => {
console.error(`Audio player error: ${error.message}`);
});
3 replies