Tracks are loaded but the bot is not connecting to vc

Yeah well ;-;
46 Replies
Wrench
WrenchOP•13mo 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 ^
round-purple
round-purple•13mo ago
Mind sharing Node and bot logs?
Wrench
WrenchOP•13mo ago
No description
Wrench
WrenchOP•13mo ago
Sure wait
Wrench
WrenchOP•13mo ago
No description
No description
Wrench
WrenchOP•13mo ago
No description
Wrench
WrenchOP•13mo ago
💀 It worked yesterday tho
round-purple
round-purple•13mo ago
Seems like you haven't added raw listener with handle raw moonlink fun- Wait
Wrench
WrenchOP•13mo ago
I did
Wrench
WrenchOP•13mo ago
No description
round-purple
round-purple•13mo ago
Unless it previously sent voice, it's that Oceanic?
Wrench
WrenchOP•13mo ago
no?
MEE6
MEE6•13mo ago
GG @Wrench, you just advanced to level 1!
round-purple
round-purple•13mo ago
Djs?
Wrench
WrenchOP•13mo ago
yes
round-purple
round-purple•13mo ago
then it's client.on('raw'
Wrench
WrenchOP•13mo ago
oh wai- ok
round-purple
round-purple•13mo ago
Give that a shoot and see
Wrench
WrenchOP•13mo ago
i was dumb thanks.
round-purple
round-purple•13mo ago
Np lmao
Wrench
WrenchOP•13mo ago
let me jus kill myself
round-purple
round-purple•13mo ago
🤣
Wrench
WrenchOP•13mo ago
ok nvm it still doesnt work bot aint connecting
round-purple
round-purple•13mo ago
Node and bot logs again
Wrench
WrenchOP•13mo ago
No description
No description
Wrench
WrenchOP•13mo ago
let me try loggin the raw event
round-purple
round-purple•13mo ago
yeah
Wrench
WrenchOP•13mo ago
there's no voice server update event 💀
Wrench
WrenchOP•13mo ago
No description
round-purple
round-purple•13mo ago
Then it's not reaching player.connect Also, you can call it everytime No need to make it inside an if
Wrench
WrenchOP•13mo ago
alr
round-purple
round-purple•13mo ago
But have you executed the join command? If not, it won't send you the voice server update
Wrench
WrenchOP•13mo ago
yea i did wait a sec ok it doesnt work
round-purple
round-purple•13mo ago
What exactly?
Wrench
WrenchOP•13mo ago
its still not connecting, and there's no voice server update events
round-purple
round-purple•13mo ago
Is the bot connecting to the voice channel though?
Wrench
WrenchOP•13mo ago
no
round-purple
round-purple•13mo ago
Mind showing your join command?
Wrench
WrenchOP•13mo 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
round-purple
round-purple•13mo ago
client.guilds.cache.get(id).shard.send(JSON.parse(payload)) Use that in the send payload function
Wrench
WrenchOP•13mo ago
ok alr it works now
Wrench
WrenchOP•13mo ago
thanks for the help bro
round-purple
round-purple•13mo 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•13mo ago
sure- see ya
round-purple
round-purple•13mo ago
See you!

Did you find this page helpful?