larsrickert / discord-player-plus

🤖 Library for creating discord music bots using discord.js v14 written in TypeScript.
https://discordplayerplus.lars-rickert.de
MIT License
7 stars 2 forks source link

The bot does not join the voice #29

Closed Falkys closed 5 months ago

Falkys commented 5 months ago

Describe the bug

const player = client.player.get(message.guild.id)

const searchResult = await player.search("Metamorphosis");

if (searchResult?.tracks.length) {

  await player.play({

    channel: channel,

    tracks: searchResult.tracks[0],

  });

}

Reproduction

I run the code and the bot says that everything is fine, although it doesn’t log into voice and doesn’t write anything to the console. Adms perms he has

System Info

Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.2 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    discord-player-plus: ^2.0.5 => 2.0.5
    discord.js: ^14.14.1 => 14.14.1

Validations

larsrickert commented 5 months ago

Hey, the player does not log errors directly. Can you please add an error listener and check if there are any errors emitted?

You can add player listeners like so (or see docs):

player.on("error", (error) => {
  console.log("Player error", error);
});

Using the pre-build play command works fine for me

Falkys commented 5 months ago

Hey, the player does not log errors directly. Can you please add an error listener and check if there are any errors emitted?

You can add player listeners like so (or see docs):

player.on("error", (error) => {
  console.log("Player error", error);
});

Using the pre-build play command works fine for me

error listener did not detect any errors and the commands do not work, slashs are not added

larsrickert commented 5 months ago

error listener did not detect any errors and the commands do not work, slashs are not added

When not even the slash commands are added then thats a sign that your bot does not connect to discord at all. Is it shown as online?

If yes, can you please change to code to the following and provide me the console output?


console.log("DEBUG 1");

const player = client.player.get(message.guild.id);

console.log("DEBUG 2");

player.on("error", (error) => {
  console.log("Player error", error);
});

const searchResult = await player.search("Metamorphosis");

console.log("DEBUG 3", searchResult);

if (searchResult?.tracks.length) {
  await player.play({
    channel: channel,
    tracks: searchResult.tracks[0],
  });
}

console.log("DEBUG 4");