Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JUNSKIx1 opened this issue May 30, 2023 · 0 comments
Open

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

JUNSKIx1 opened this issue May 30, 2023 · 0 comments
Assignees
Labels

Comments

@JUNSKIx1
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants