#Bot Isn't Singing

1 messages · Page 1 of 1 (latest)

keen sun
#

I have added play cmd and the bot joins the vc but doesn't play the song it remain silent
When i debug the code it says

Now playing: Diet Mountain Dew
Player connected: false
Node connected: true
Current track: Diet Mountain Dew
Queue size: 0

This is code
let player = client.player.getPlayer(interaction.guildId);
if (!player) {
player = await client.player.createPlayer({
guildId: interaction.guild.id,
voiceChannelId: channel.id,
textChannelId: interaction.channel.id,
selfDeaf: true,
});
}
player.connect();

try {
// Search for track
const result = await player.node.search(
{ query, source: "ytmsearch" },
interaction.user
);

// Add to queue
if (result.loadType === "playlist") {
  player.queue.add(result.tracks);
} else {
  player.queue.add(result.tracks[0]);
}

// Start playback if not already playing
if (!player.playing && !player.paused && !player.queue.current) {
  await player.play();
}

// Reply with info
const reply =
  result.loadType === "playlist"
    ? `Added ${result.tracks.length} tracks from playlist ${result.playlist.title}`
    : `Now playing ${trimTitle(result.tracks[0].info.title)} — requested by <@${interaction.user.id}>`;

await interaction.editReply({ content: reply });

} catch (err) {
console.error("Play command error:", err);
await interaction.editReply({
content: "An error occurred while trying to play that track.",
});
}
};

true sailBOT
#

Please make sure to read and follow the post guidelines before opening your post.
This will help you get the best possible answers to your questions while minimizing the questions we have to ask you.
Thanks!