Buttons interactions

How can i make my buttons only usable once ? I dont want to delete them , i just want to make them unusable
10 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
JollyJohn
JollyJohn3y ago
collector or set the button disabled after they have been clicked
Ashura
AshuraOP3y ago
how can i detect them when they are clicked
JollyJohn
JollyJohn3y ago
you would get the button id
d.js docs
d.js docs3y ago
guide Interactions: Receiving button interactions read more
JollyJohn
JollyJohn3y ago
and if it is clicked then set the buttons disabled you could also just send a new row that has them disabled if you wanted, numerous ways to do this
Ashura
AshuraOP3y ago
thank yall new to coding in js , aprecciate ur help
JollyJohn
JollyJohn3y ago
mhm
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Ashura
AshuraOP3y ago
@nobcop just a noob question , how can i collect the data from 'dinoname'
const { SlashCommandBuilder ,ActionRowBuilder, ButtonBuilder , EmbedBuilder , Events } = require('@discordjs/builders');
const { MessageEmbed , ButtonStyle} = require("discord.js")

module.exports = {
data: new SlashCommandBuilder()
.setName('create')
.setDescription('Cria uma ficha de Breed')
.addStringOption(option =>
option.setName('dinoname')
.setDescription('Dino que sera breedado')
.setRequired(true)),
async execute(interaction) {
await interaction.reply(
embed = new EmbedBuilder()
.setTitle(``dinoname` Line`)
.setDescription(`Selecione os status breedados `dinoname``)
.setColor("#f20505"),
row = new ActionRowBuilder()
.addComponents(

new ButtonBuilder()
.setCustomId('health')
.setLabel('Health')
.setStyle (ButtonStyle.Secondary)
.setEmoji('1045048019285966848'),

new ButtonBuilder()
.setCustomId('stamina')
.setLabel('Stamina')
.setStyle(ButtonStyle.Secondary)
.setEmoji('1045048216753819709'),

new ButtonBuilder()
.setCustomId('melee')
.setLabel('Melee')
.setStyle(ButtonStyle.Secondary)
.setEmoji('1045048217982738553'),

new ButtonBuilder()
.setCustomId('continue')
.setLabel('Continuar')
.setStyle(ButtonStyle.Success)
.setEmoji('1045430134192222220'),

new ButtonBuilder()
.setCustomId('cancell')
.setLabel('Cancelar')
.setStyle(ButtonStyle.Danger)
.setEmoji('1045430320993931274')
)
)
}
}
const { SlashCommandBuilder ,ActionRowBuilder, ButtonBuilder , EmbedBuilder , Events } = require('@discordjs/builders');
const { MessageEmbed , ButtonStyle} = require("discord.js")

module.exports = {
data: new SlashCommandBuilder()
.setName('create')
.setDescription('Cria uma ficha de Breed')
.addStringOption(option =>
option.setName('dinoname')
.setDescription('Dino que sera breedado')
.setRequired(true)),
async execute(interaction) {
await interaction.reply(
embed = new EmbedBuilder()
.setTitle(``dinoname` Line`)
.setDescription(`Selecione os status breedados `dinoname``)
.setColor("#f20505"),
row = new ActionRowBuilder()
.addComponents(

new ButtonBuilder()
.setCustomId('health')
.setLabel('Health')
.setStyle (ButtonStyle.Secondary)
.setEmoji('1045048019285966848'),

new ButtonBuilder()
.setCustomId('stamina')
.setLabel('Stamina')
.setStyle(ButtonStyle.Secondary)
.setEmoji('1045048216753819709'),

new ButtonBuilder()
.setCustomId('melee')
.setLabel('Melee')
.setStyle(ButtonStyle.Secondary)
.setEmoji('1045048217982738553'),

new ButtonBuilder()
.setCustomId('continue')
.setLabel('Continuar')
.setStyle(ButtonStyle.Success)
.setEmoji('1045430134192222220'),

new ButtonBuilder()
.setCustomId('cancell')
.setLabel('Cancelar')
.setStyle(ButtonStyle.Danger)
.setEmoji('1045430320993931274')
)
)
}
}
Want results from more Discord servers?
Add your server