This commit is contained in:
parent
bb33054edb
commit
ed6603e365
@ -48,20 +48,7 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Agora enviamos o embed e o botão juntos na mesma mensagem
|
await interaction.editReply({ embeds: [embed] });
|
||||||
const rowButton = new ActionRowBuilder().addComponents(
|
|
||||||
new ButtonBuilder()
|
|
||||||
.setCustomId('mostrarDropdown')
|
|
||||||
.setLabel('Escolher Recurso')
|
|
||||||
.setStyle(1) // PRIMARY (valor 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
content: '🛠️ Clica no botão para escolher o recurso:',
|
|
||||||
embeds: [embed],
|
|
||||||
components: [rowButton], // Incluímos o botão na mensagem
|
|
||||||
ephemeral: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao buscar usuários:', error);
|
console.error('Erro ao buscar usuários:', error);
|
||||||
@ -100,6 +87,21 @@ module.exports = {
|
|||||||
.addOptions(options);
|
.addOptions(options);
|
||||||
|
|
||||||
const rowSelect = new ActionRowBuilder().addComponents(select);
|
const rowSelect = new ActionRowBuilder().addComponents(select);
|
||||||
|
const rowButton = new ActionRowBuilder().addComponents(
|
||||||
|
new ButtonBuilder()
|
||||||
|
.setCustomId('mostrarDropdown')
|
||||||
|
.setLabel('Escolher Recurso')
|
||||||
|
.setStyle(1) // Usando o valor numérico para PRIMARY (1)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Armazenar texto do coletor
|
||||||
|
let collectorText = '🛠️ Clica no botão para escolher o recurso:';
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
content: collectorText,
|
||||||
|
components: [rowButton],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
|
||||||
// Espera pelo clique no botão
|
// Espera pelo clique no botão
|
||||||
const filter = (i) => i.customId === 'mostrarDropdown' && i.user.id === interaction.user.id;
|
const filter = (i) => i.customId === 'mostrarDropdown' && i.user.id === interaction.user.id;
|
||||||
@ -107,17 +109,25 @@ module.exports = {
|
|||||||
|
|
||||||
collector.on('collect', async (i) => {
|
collector.on('collect', async (i) => {
|
||||||
if (i.customId === 'mostrarDropdown') {
|
if (i.customId === 'mostrarDropdown') {
|
||||||
|
collectorText = '🛠️ Agora escolhe o recurso:';
|
||||||
|
|
||||||
await i.update({
|
await i.update({
|
||||||
content: '🛠️ Agora escolhe o recurso:',
|
content: collectorText,
|
||||||
components: [rowSelect], // Atualizamos com o select menu
|
components: [rowSelect],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
collector.on('end', (collected) => {
|
collector.on('end', async (collected) => {
|
||||||
if (collected.size === 0) {
|
if (collected.size === 0) {
|
||||||
interaction.editReply({ content: '❌ O tempo para escolher o recurso expirou.' });
|
collectorText = '❌ O tempo para escolher o recurso expirou.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Atualizar o embed final com o texto do coletor
|
||||||
|
await interaction.editReply({
|
||||||
|
content: collectorText,
|
||||||
|
components: [],
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user