Tracks are loaded but the bot is not connecting to vc

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

Did you find this page helpful?