Bot responding from a button, and answer with a text and two buttons more
Hi! I have a problem on my code.....I dont know how to do this:
When only the Staff click on the button that says "Panel de Staff", the bot has to respond with a text with two more buttons, thats all, here is the image if someone could help me pls
2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPyes, I know that sorry, the real problem goes when I dont know how to do that when the Staff click on the button "Panel de Staff", the bot responses with a text and two more buttons
const Discord = require('discord.js');
const guildTicketCategoryId = '1242529125424435311'; // Categoria donde se abriran los tickets
const AdminRole = '1242270979896381461'; // Id Rol de moderacion
const Staff = '1242471734528053389' // Id Rol de Staff
const Helpdesk = '<@&1242521614063501355>'; // Id Rol de Helpdesk
const ticketPanelStaffButton = new Discord.ActionRowBuilder().addComponents(
new Discord.ButtonBuilder()
.setCustomId('panel-create')
.setLabel('Panel de Staff')
.setEmoji('💻')
.setStyle(2)
)
async function main (interaction) {
const {user, guild} = interaction;
const ticketType = interaction.values[0];
const tickets = guild.channels.cache.filter(channel => channel.parentId === guildTicketCategoryId);
if(tickets.some(ticket => ticket.topic === user.id)) return interaction.reply({content: 'Ya tienes un ticket abierto', ephemeral: true})
// Si el usuario no tiene tickets abiertos, procedemos con la creacion del ticket:
interaction.reply({content: '- Tu ticket está siendo creado...', ephemeral: true})
.then(() => {
guild.channels.create({
name: ticketType+'-'+user.username.slice(0, 25-ticketType.length),
topic: user.id,
type: Discord.ChannelType.GuildText,
parent: guildTicketCategoryId,
permissionOverwrites: [
{id: interaction.guild.roles.everyone, deny: [Discord.PermissionsBitField.Flags.ViewChannel]},
{id: Staff, allow: [Discord.PermissionsBitField.Flags.ViewChannel]},
{id: interaction.user.id, allow: [Discord.PermissionsBitField.Flags.ViewChannel]}
]
}).then(channel => {
interaction.editReply({content:
- Tu ticket ha sido creado: ${channel}
});
channel.send({
content: ¡¡Bienvenido ${user}!! 👋, \nAcabas de abrir un ticket por el siguiente motivo: __${ticketType}__, \nEl ${Helpdesk} se pondrá en contacto con usted lo antes posible por este mismo canal \n\nFecha: ${new Date().toLocaleString()}
,
components: [ticketPanelStaffButton]
});
})
});
};
module.exports = main;
This is my Code
Is a ticket-system
Any idea about how to do that? @Qjuh
ooh... in the same way?
Ty :churumbel_cora_dev:
I really thought that was diff, sorry jajaja