Tracks are loaded but the bot is not connecting to vc

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

Did you find this page helpful?