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]);
},
};
18 Replies
Naseem
NaseemOP13mo ago
@Gino
viztea
viztea13mo ago
what version are you using
Naseem
NaseemOP13mo ago
discord.js is: 14.14.1 lavaclient: 4.1.1
viztea
viztea13mo ago
check the djs example repo on how to setup lavaclient with djs
viztea
viztea13mo 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.
Naseem
NaseemOP13mo 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]);
},
};
viztea
viztea13mo ago
are you using lavalink v4
Naseem
NaseemOP13mo ago
yes
Naseem
NaseemOP13mo 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...
viztea
viztea13mo ago
you need to use lavaclient v5
Naseem
NaseemOP13mo ago
oh ok
viztea
viztea13mo ago
yarn add lavaclient@next or (p)npm install lavaclient@next
Naseem
NaseemOP13mo ago
but the handlers for lavaclient and commands are same?
viztea
viztea13mo ago
no
Naseem
NaseemOP13mo ago
damn any documentation available?
viztea
viztea13mo ago
there’s a test project since lavalink v4 is still in beta i haven’t taken time to write docs
Naseem
NaseemOP13mo ago
can u send link of github? ?
viztea
viztea13mo ago
take a look at the pinned post in this channel
Want results from more Discord servers?
Add your server