Tracks are loaded but the bot is not connecting to vc

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

Did you find this page helpful?