SushiBtw / discord-music-player

Complete framework to facilitate music commands using discord.js v14 & v13.
https://discord-music-player.js.org/
MIT License
157 stars 65 forks source link

TypeError: client.player.getQueue is not a function #326

Open JUNSKIx1 opened 1 year ago

JUNSKIx1 commented 1 year ago

I'm pretty new to creating discord bots but I have experience in javascript. After fixing some bugs that I created I got an error when creating a queue for the songs in my play.js command file

const queue = await client.player.createQueue(interaction.guild); It says that createQueue is not a function. I have importet and installed all needed packages but it won't work. After on I use the queue variable to add Tracks or to play the queue

if (!queue.playing) await queue.play(); or

await queue.addTracks(result.tracks)

My index js looks like this: `const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages]})

// List of all commands const commands = []; client.commands = new Collection();

const commandsPath = path.join(__dirname, "commands"); // E:\yt\discord bot\js\intro\commands const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); for(const file of commandFiles) { const filePath = path.join(commandsPath, file); const command = require(filePath);

client.commands.set(command.data.name, command);
commands.push(command.data.toJSON());

}

const player = new Player(client, { leaveOnEmpty: false, // This options are optional. }); // You can define the Player as client.player to easily access it. client.player = player;`

I don't know what went wrong and I can find no other fixes in the internet so maybe someone can help me.