can't join a channel

when i try to join a channel it says it joined but didn't join it send Connecting to voice channel: 1233157221181948117 to the log but don't join
No description
5 Replies
Turki
TurkiOP•8mo ago
const { Client, MessageEmbed } = require("discord.js");
const { joinVoiceChannel } = require("@discordjs/voice");

module.exports = {
name: "join",
aliases: ["j"],
run: async (client, message, args) => {
if (!message.member.voice.channel) {
return message.reply(
":hi: | You need to be in a voice channel for me to join."
);
}

const voiceChannel = message.member.voice.channel;

try {
const player = client.moon.players.create({
guildId: message.guild.id,
textChannel: message.channel.id,
voiceChannel: message.member.voice.channel.id,
});

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false,
});
console.log(`Connecting to voice channel: ${voiceChannel.id}`);
} else {
return message.reply(":x: I am already in a voice channel.");
}

const embed = new MessageEmbed()
.setColor("#00FF00")
.setTitle(":discordlogo:・Joined Voice Channel")
.setDescription(`Successfully joined the voice channel: ${voiceChannel.name}`)
.setFooter({
text: `Requested by: ${message.author.username}`,
});

message.reply({ embeds: [embed] });
} catch (error) {
console.error(error);
message.reply(":x: An error occurred while trying to join the voice channel.");
}
},
};
const { Client, MessageEmbed } = require("discord.js");
const { joinVoiceChannel } = require("@discordjs/voice");

module.exports = {
name: "join",
aliases: ["j"],
run: async (client, message, args) => {
if (!message.member.voice.channel) {
return message.reply(
":hi: | You need to be in a voice channel for me to join."
);
}

const voiceChannel = message.member.voice.channel;

try {
const player = client.moon.players.create({
guildId: message.guild.id,
textChannel: message.channel.id,
voiceChannel: message.member.voice.channel.id,
});

if (!player.connected) {
player.connect({
setDeaf: true,
setMute: false,
});
console.log(`Connecting to voice channel: ${voiceChannel.id}`);
} else {
return message.reply(":x: I am already in a voice channel.");
}

const embed = new MessageEmbed()
.setColor("#00FF00")
.setTitle(":discordlogo:・Joined Voice Channel")
.setDescription(`Successfully joined the voice channel: ${voiceChannel.name}`)
.setFooter({
text: `Requested by: ${message.author.username}`,
});

message.reply({ embeds: [embed] });
} catch (error) {
console.error(error);
message.reply(":x: An error occurred while trying to join the voice channel.");
}
},
};
this is my current code @1Lucas1.apk it joins now but no sound
Jasper
Jasper•8mo ago
There is no playback code, only the join function.
Jasper
Jasper•8mo ago
GitHub
moonlink.js/testBot/commands/music/play.js at v3 · Ecliptia/moonlin...
MoonLink.js is a simple package for lavalink client, perfect for you to create your discord bot with songs, and very simple and easy to use. - Ecliptia/moonlink.js
Jasper
Jasper•8mo ago
Please check the example play code provided by Moonlink.js lib
MEE6
MEE6•8mo ago
GG @Jasper, you just advanced to level 6!

Did you find this page helpful?