5

I am trying to make my bot work, yet again.

This is my play function.

function play(connection, message) {
        var server = servers[message.guild.id];
        server.dispatcher = connection.play(
          ytdl(server.queue[0], { filter: "audioonly" })
        );
        server.queue.shift();

        server.dispatcher.on("end", function() {
          if (server.queue[0]) {
            play(connection, message);
          } else {
            connection.disconnect();
          }
        });
      }

and it does play.

if (!message.guild.voiceConnection)
        message.member.voice.channel.join().then(function(connection) {
          message.channel.send("Playing tune now, Enjoy!");
          play(connection, message);
          console.log("Playing tune now!");
        });

I get my log that it's playing and after a few seconds or so I get an error message

TypeError: Cannot convert "null" to int

TypeError: Cannot convert "null" to int

and something here

discord-music-bot\node_modules\opusscript\build\opusscript_native_wasm.js:8 (TypeError: Cannot convert "null" to int)

Other scripts that are also mentioned in the discord.js documentation I can't install and I have tried everything I could think of.

Community
  • 1
  • 1
vojislav
  • 105
  • 1
  • 8

1 Answers1

1

As sugessted on this github thread you should try using @discordjs/opus or node-opus instead of opusscript.

Olivia Stork
  • 4,660
  • 5
  • 27
  • 40
Runner
  • 81
  • 8