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 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.
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);
}
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.