Я нахожусь в процессе создания бота Discord с JS, предоставляя ему управление, автоматическую роль и т. Д. c. Я только что попал в раздел musi c, и я не могу понять, что не так. Я правильно установил FFmpeg, так как у меня есть доступ к нему из терминала. Я также использовал mpm для добавления ytdl-core и opusscript в свою программу, но он все равно выдает ошибку:
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
C:\Users\USERNAME\Desktop\Discord Bot\node_modules\opusscript\build\opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var
key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}
Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=
function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=
[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=
false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=
typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";
ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions===
"object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=
ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=
!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";
function locateFile(path){i
abort(TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type
string. Received type object). Build with -s ASSERTIONS=1 for more info.
Вот мой код для вызова play:
case 'play':
function play(connection, message){
var server = servers[message.guild.id];
server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: 'audioonly'}));
server.queue.shift();
server.dispatcher.on('end', function(){
if(server.queue[0]){
play(connection, message);
}else {
connection.disconnect();
}
})
}
if(!args[1]){
message.channel.send('You need to provide a link!');
return;
}
if(!message.member.voiceChannel){
message.channel.send('You must be in a voice channel to play music!');
return;
}
if(!servers[message.guild.id]) servers[message.guild.id] = {
queue: []
}
var server = servers[message.guild.id];
server.queue.push(args[1]);
if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
play(connection, message);
})
break;
Если бы кто-нибудь мог помочь с этим, я был бы очень благодарен.