ReferenceError: sendWithDiscordLib is not defined

I am getting this error:
Uncaught Promise Rejection ReferenceError: sendWithDiscordLib is not defined
at Node.sendGatewayPayload (C:\Users\nasee\Desktop\projects\yuki\src\index.js:41:42)
at Player.connect (C:\Users\nasee\Desktop\projects\yuki\node_modules\lavaclient\dist\lib\Player.js:49:19)
at Object.run (C:\Users\nasee\Desktop\projects\yuki\src\slashCommands\music\play.js:14:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Uncaught Promise Rejection ReferenceError: sendWithDiscordLib is not defined
at Node.sendGatewayPayload (C:\Users\nasee\Desktop\projects\yuki\src\index.js:41:42)
at Player.connect (C:\Users\nasee\Desktop\projects\yuki\node_modules\lavaclient\dist\lib\Player.js:49:19)
at Object.run (C:\Users\nasee\Desktop\projects\yuki\src\slashCommands\music\play.js:14:10)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Here is my code of play command:
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'music',
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song!')
.addStringOption(option => option.setName('name').setDescription('Name of the song.').setRequired(true)),
run: async (client, interaction) => {
const results = await client.music.rest.loadTracks("ytsearch:kurdo business narcotic");
console.log(interaction.member.voice)
await client.music
.createPlayer(interaction.guildId)
.connect(interaction.member.voice.channelId)
.play(results.tracks[0]);
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'music',
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song!')
.addStringOption(option => option.setName('name').setDescription('Name of the song.').setRequired(true)),
run: async (client, interaction) => {
const results = await client.music.rest.loadTracks("ytsearch:kurdo business narcotic");
console.log(interaction.member.voice)
await client.music
.createPlayer(interaction.guildId)
.connect(interaction.member.voice.channelId)
.play(results.tracks[0]);
},
};
N
Naseem154d ago
@Gino
V
viztea154d ago
what version are you using
N
Naseem154d ago
discord.js is: 14.14.1 lavaclient: 4.1.1
V
viztea154d ago
check the djs example repo on how to setup lavaclient with djs
V
viztea154d ago
GitHub
djs-v13-example/src/lib/Bot.ts at main · lavaclient/djs-v13-example
📦️ example discord.js v13 bot. Contribute to lavaclient/djs-v13-example development by creating an account on GitHub.
N
Naseem154d ago
alr thx uhhh @Gino sorry if im annoying u but now im getting this err:
{
timestamp: 1701459894090,
status: 404,
error: 'Not Found',
message: 'Not Found',
path: '/loadtracks'
}
{
timestamp: 1701459894090,
status: 404,
error: 'Not Found',
message: 'Not Found',
path: '/loadtracks'
}
Here is play command code:
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'music',
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song!')
.addStringOption(option => option.setName('name').setDescription('Name of the song.').setRequired(true)),
run: async (client, interaction) => {
const results = await client.music.rest.loadTracks("ytsearch:kurdo business narcotic");
console.log(results)
await client.music
.createPlayer(interaction.guildId)
.connect(interaction.member.voice.channelId)
.play(results.tracks[0]);
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
category: 'music',
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Play a song!')
.addStringOption(option => option.setName('name').setDescription('Name of the song.').setRequired(true)),
run: async (client, interaction) => {
const results = await client.music.rest.loadTracks("ytsearch:kurdo business narcotic");
console.log(results)
await client.music
.createPlayer(interaction.guildId)
.connect(interaction.member.voice.channelId)
.play(results.tracks[0]);
},
};
V
viztea154d ago
are you using lavalink v4
N
Naseem154d ago
yes
N
Naseem154d ago
GitHub
Release 4.0.0-beta.5 · lavalink-devs/Lavalink
Update lavaplayer to 2.0.3 - Fixed YouTube access token errors Added default plugin repository. Plugin devs can now request their plugin to be added to the default repository. For more info see her...
V
viztea154d ago
you need to use lavaclient v5
N
Naseem154d ago
oh ok
V
viztea154d ago
yarn add lavaclient@next or (p)npm install lavaclient@next
N
Naseem154d ago
but the handlers for lavaclient and commands are same?
V
viztea154d ago
no
N
Naseem154d ago
damn any documentation available?
V
viztea154d ago
there’s a test project since lavalink v4 is still in beta i haven’t taken time to write docs
N
Naseem154d ago
can u send link of github? ?
V
viztea154d ago
take a look at the pinned post in this channel