Tracks are loaded but the bot is not connecting to vc

Yeah well ;-;
46 Replies
Wrench
WrenchOP•11mo ago
Let me send the code
let query = this.interaction.options.getString("query");

let player = this.client.lavalinkClient.players.get(
this.interaction.guildId
);

let voiceChannel = await this.client.lavalinkClient.getMemberVoiceChannel(
this.interaction.guild,
this.interaction.user.id
);
if (!voiceChannel) {
await this.interaction.reply({
content: "You need to be in a voice channel to play music",
ephemeral: true,
});
return;
}

if (!player) {
player = this.client.lavalinkClient.players.create({
guildId: this.interaction.guildId,
textChannel: this.interaction.channelId,
voiceChannel: voiceChannel.id,
autoPlay: true,
});
}

player.voiceChannel = voiceChannel.id;

if (!player.connected) {
player.connect({
setDeaf: true,
});
}

let results = await this.client.lavalinkClient.search({
query,
requester: this.interaction.user.id,
});

if (results.loadType === "playlist") {
for (let track of results.tracks) {
player.queue.add(track);
}

await this.interaction.reply({
content: `Queued ${results.playlistInfo.name}`,
});
} else {
player.queue.add(results.tracks[0]);
await this.interaction.reply({
content: `Queued ${results.tracks[0].title}`,
});
}

if (!player.playing) {
await player.play();
}
let query = this.interaction.options.getString("query");

let player = this.client.lavalinkClient.players.get(
this.interaction.guildId
);

let voiceChannel = await this.client.lavalinkClient.getMemberVoiceChannel(
this.interaction.guild,
this.interaction.user.id
);
if (!voiceChannel) {
await this.interaction.reply({
content: "You need to be in a voice channel to play music",
ephemeral: true,
});
return;
}

if (!player) {
player = this.client.lavalinkClient.players.create({
guildId: this.interaction.guildId,
textChannel: this.interaction.channelId,
voiceChannel: voiceChannel.id,
autoPlay: true,
});
}

player.voiceChannel = voiceChannel.id;

if (!player.connected) {
player.connect({
setDeaf: true,
});
}

let results = await this.client.lavalinkClient.search({
query,
requester: this.interaction.user.id,
});

if (results.loadType === "playlist") {
for (let track of results.tracks) {
player.queue.add(track);
}

await this.interaction.reply({
content: `Queued ${results.playlistInfo.name}`,
});
} else {
player.queue.add(results.tracks[0]);
await this.interaction.reply({
content: `Queued ${results.tracks[0].title}`,
});
}

if (!player.playing) {
await player.play();
}
The play command ^
adverse-sapphire
adverse-sapphire•11mo ago
Mind sharing Node and bot logs?
Wrench
WrenchOP•11mo ago
No description
Wrench
WrenchOP•11mo ago
Sure wait
Wrench
WrenchOP•11mo ago
No description
No description
Wrench
WrenchOP•11mo ago
No description
Wrench
WrenchOP•11mo ago
💀 It worked yesterday tho
adverse-sapphire
adverse-sapphire•11mo ago
Seems like you haven't added raw listener with handle raw moonlink fun- Wait
Wrench
WrenchOP•11mo ago
I did
Wrench
WrenchOP•11mo ago
No description
adverse-sapphire
adverse-sapphire•11mo ago
Unless it previously sent voice, it's that Oceanic?
Wrench
WrenchOP•11mo ago
no?
MEE6
MEE6•11mo ago
GG @Wrench, you just advanced to level 1!
adverse-sapphire
adverse-sapphire•11mo ago
Djs?
Wrench
WrenchOP•11mo ago
yes
adverse-sapphire
adverse-sapphire•11mo ago
then it's client.on('raw'
Wrench
WrenchOP•11mo ago
oh wai- ok
adverse-sapphire
adverse-sapphire•11mo ago
Give that a shoot and see
Wrench
WrenchOP•11mo ago
i was dumb thanks.
adverse-sapphire
adverse-sapphire•11mo ago
Np lmao
Wrench
WrenchOP•11mo ago
let me jus kill myself
adverse-sapphire
adverse-sapphire•11mo ago
🤣
Wrench
WrenchOP•11mo ago
ok nvm it still doesnt work bot aint connecting
adverse-sapphire
adverse-sapphire•11mo ago
Node and bot logs again
Wrench
WrenchOP•11mo ago
No description
No description
Wrench
WrenchOP•11mo ago
let me try loggin the raw event
adverse-sapphire
adverse-sapphire•11mo ago
yeah
Wrench
WrenchOP•11mo ago
there's no voice server update event 💀
Wrench
WrenchOP•11mo ago
No description
adverse-sapphire
adverse-sapphire•11mo ago
Then it's not reaching player.connect Also, you can call it everytime No need to make it inside an if
Wrench
WrenchOP•11mo ago
alr
adverse-sapphire
adverse-sapphire•11mo ago
But have you executed the join command? If not, it won't send you the voice server update
Wrench
WrenchOP•11mo ago
yea i did wait a sec ok it doesnt work
adverse-sapphire
adverse-sapphire•11mo ago
What exactly?
Wrench
WrenchOP•11mo ago
its still not connecting, and there's no voice server update events
adverse-sapphire
adverse-sapphire•11mo ago
Is the bot connecting to the voice channel though?
Wrench
WrenchOP•11mo ago
no
adverse-sapphire
adverse-sapphire•11mo ago
Mind showing your join command?
Wrench
WrenchOP•11mo ago
alr wai
let query = this.interaction.options.getString("query");

let voiceChannel = await this.client.lavalinkClient.getMemberVoiceChannel(
this.interaction.guild,
this.interaction.user.id
);
if (!voiceChannel) {
await this.interaction.reply({
content: "You need to be in a voice channel to play music",
ephemeral: true,
});
return;
}

let results = await this.client.lavalinkClient.search({
query,
requester: this.interaction.user.id,
});

let player = this.client.lavalinkClient.players.get(
this.interaction.guildId
);

if (!player) {
player = this.client.lavalinkClient.players.create({
guildId: this.interaction.guildId,
textChannel: this.interaction.channelId,
voiceChannel: voiceChannel.id,
autoPlay: true,
});

player.connect({
setDeaf: true,
});
}

if (results.loadType === "playlist") {
for (let track of results.tracks) {
player.queue.add(track);
}

await this.interaction.reply({
content: `Queued ${results.playlistInfo.name}`,
});
} else {
player.queue.add(results.tracks[0]);
await this.interaction.reply({
content: `Queued ${results.tracks[0].title}`,
});
}

if (!player.playing) {
await player.play();
}
let query = this.interaction.options.getString("query");

let voiceChannel = await this.client.lavalinkClient.getMemberVoiceChannel(
this.interaction.guild,
this.interaction.user.id
);
if (!voiceChannel) {
await this.interaction.reply({
content: "You need to be in a voice channel to play music",
ephemeral: true,
});
return;
}

let results = await this.client.lavalinkClient.search({
query,
requester: this.interaction.user.id,
});

let player = this.client.lavalinkClient.players.get(
this.interaction.guildId
);

if (!player) {
player = this.client.lavalinkClient.players.create({
guildId: this.interaction.guildId,
textChannel: this.interaction.channelId,
voiceChannel: voiceChannel.id,
autoPlay: true,
});

player.connect({
setDeaf: true,
});
}

if (results.loadType === "playlist") {
for (let track of results.tracks) {
player.queue.add(track);
}

await this.interaction.reply({
content: `Queued ${results.playlistInfo.name}`,
});
} else {
player.queue.add(results.tracks[0]);
await this.interaction.reply({
content: `Queued ${results.tracks[0].title}`,
});
}

if (!player.playing) {
await player.play();
}
i dont have a seperate cmd for joining the voice channel btw
adverse-sapphire
adverse-sapphire•11mo ago
client.guilds.cache.get(id).shard.send(JSON.parse(payload)) Use that in the send payload function
Wrench
WrenchOP•11mo ago
ok alr it works now
Wrench
WrenchOP•11mo ago
thanks for the help bro
adverse-sapphire
adverse-sapphire•11mo ago
Awesome! No problem -- if you have any other issue, just create another post (and ping me if I don't see it)
Wrench
WrenchOP•11mo ago
sure- see ya
adverse-sapphire
adverse-sapphire•11mo ago
See you!

Did you find this page helpful?