yuyaaici_YT
yuyaaici_YT
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 7/3/2023 in #djs-questions
Button
How can I reuse the same button of my discord bot multiple times? because after the first time that I pressed the button I can't press it again.
19 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 3/2/2023 in #djs-questions
Last message BOT
I should do that when the song ends embed gets deleted, I tried using the command channel.last.Message.delete() but with this string deletes the last message that is in the chat but not that of the bot, thanks for the help
6 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 12/30/2022 in #djs-questions
how do I tell the bot that it needs to delete its last message sent
Hi, how do I tell the bot that it needs to delete its last message sent
4 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 12/27/2022 in #djs-questions
Buttons
Hi, I have this code here: distube.on("playSong", (queue, song) => { let embed = new Discord.MessageEmbed() .setTitle("Playing song...") .addField("Song", song.name) .addField("Requested by", song.user.toString()) queue.textChannel.send({ embeds: [embed] }); songCount += 1; console.log(chalk.red(songCount = ${songCount})); let button1 = new Discord.MessageButton() .setEmoji("❗") .setLabel("Stop!") .setStyle("SECONDARY") .setCustomId(buttonstop,${song.user.id}); let row = new Discord.MessageActionRow() .addComponents(button1); queue.textChannel.send({ components: [row] }); client.on("interactionCreate", interaction => { if (!interaction.isButton()) return; if (interaction.customId.startsWith("buttonstop")) { interaction.deferUpdate(); const voiceChannel = interaction.member.voice.channel; if (!voiceChannel) { return interaction.reply("You must be in a voice channel to execute this command"); } const voiceChannelBot = interaction.guild.channels.cache.find(channel => channel.type == "GUILD_VOICE" && channel.members.has(client.user.id)); if (voiceChannelBot && voiceChannel.id !== voiceChannelBot.id) { return interaction.reply("This bot is already in use in another voice chat"); } try { distube.stop(interaction); } catch { return interaction.reply("No songs playing or songs already stopped"); } interaction.channel.send("Bye"); } }); }); In this code there is a problem but I do not understand where, in the console I get this error: DiscordAPIError: Interaction has already been acknowledged.
13 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 12/25/2022 in #djs-questions
button spam
client.on("messageCreate", message => { if (message.content.startsWith("-play") message.content.startsWith("-start") message.content.startsWith("-P")) { 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 chat") } let args = message.content.split(/\s+/) let query = args.slice(1).join(" ") if (!query) { return message.channel.send("Enter the song you want to listen to") } distube.play(voiceChannelBot || voiceChannel, query, { member: message.member, textChannel: message.channel, message: message }) client.on("messageCreate", message => { let button1 = new Discord.MessageButton() .setEmoji("❗") .setLabel("stop!") .setStyle("SUCCESS") .setCustomId(buttonstop,${message.author.id})
let row = new Discord.MessageActionRow() .addComponents(button1) message.channel.send({components: {row}}); } )
client.on("interactionCreate", interaction => { if (!interaction.isButton()) return
if (interaction.customId.startsWith("buttonstop")) {
interaction.deferUpdate() const voiceChannel = interaction.member.voice.channel if (!voiceChannel) { return interaction.reply("You must be in a voice channel to run this command") }
const voiceChannelBot = interaction.guild.channels.cache.find(x => x.type == "GUILD_VOICE" && x.members.has(client.user.id)) if (voiceChannelBot && voiceChannel.id != voiceChannelBot.id) { return interaction.reply("This bot is already in use in another chat") }
try { distube.stop(interaction) } catch { return interaction.reply("No songs playing") }
interaction.channel.send("Bye")
} }) }
18 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 12/25/2022 in #djs-questions
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] }) } })
6 replies
DIAdiscord.js - Imagine an app
Created by yuyaaici_YT on 12/24/2022 in #djs-questions
button to go on with the song
Hello, I would need to implement the button to go on with the song but I would not know how to do it and I'm here to ask you if you can give me some help, this is the code I use if (message.content.startsWith("-play") message.content.startsWith("-start") message.content.startsWith("-P")) { const voiceChannel = message.member.voice.channel if (!voiceChannel) { return message.channel.send("You must be in a voice channel to run this commandYou 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 chat") } let args = message.content.split(/\s+/) let query = args.slice(1).join(" ") if (!query) { return message.channel.send("Enter the song you want to listen to") } distube.play(voiceChannelBot || voiceChannel, query, { member: message.member, textChannel: message.channel, message: message }) }
4 replies