Go to the next song with a button

Hi, I have a function that serves to move to the next song but I do not know why when I use this function I get an error in the console the code I use is this client.on("messageCreate", message => { if (message.content == "-skip") { let embed = new Discord.MessageEmbed() .setTitle("Hello! If you want to move on to the next song click the skip button"") let button1 = new Discord.MessageButton() .setEmoji("❗") .setLabel("Skip!") .setStyle("SUCCESS") .setCustomId(clickButton1,${message.author.id})
let row = new Discord.MessageActionRow() .addComponents(button1)
message.channel.send({ embeds: [embed], components: [row] })
} })
client.on("interactionCreate", interaction => { if (!interaction.isButton()) return
if (interaction.customId.startsWith("clickButton1")) {
const voiceChannel = message.member.voice.channel if (!voiceChannel) { return message.channel.send("You must be in a voice channel to run this command") }
const voiceChannelBot = message.guild.channels.cache.find(x => x.type == "GUILD_VOICE" && x.members.has(client.user.id)) if (voiceChannelBot && voiceChannel.id != voiceChannelBot.id) { return message.channel.send("This bot is already in use in another voice chat") }
try { distube.skip(message) } catch { return message.channel.send("No songs playing") }
message.channel.send("The song was skipped")
interaction.message.edit({ embeds: [embed] }) } })
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
yuyaaici_YT
yuyaaici_YTOP2y ago
yes This error appears in the console: ReferenceError: message is not defined and what should I do to fix this problem ok thanks
Want results from more Discord servers?
Add your server