#inter
55 messages · Page 1 of 1 (latest)
i use v13.8.0
you’re using a collector?
yes
are you here?
pass a filter to the collector then
no need to ping me twice
if I dont reply I'm not available
client.on('messageCreate', message => {
if (message.content === "test" || message.content === "-test") {
const embed = new Discord.MessageEmbed()
.setDescription("**To See Test choose**");
let row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('select')
.setPlaceholder('Selected')
.addOptions([
{
label: 'Test',
description: 'Test Done',
value: 'test',
emoji: '👍'
}
])
);
message.reply({ embeds: [embed], components: [row] });
}
});
client.on('interactionCreate', async interaction => {
if(!interaction.isSelectMenu()) return;
if(interaction.isSelectMenu()) {
if(interaction.values[0] == 'test') {
let embed = new Discord.MessageEmbed()
.setDescription(`**Done**`)
await interaction.update({embeds: [embed]})
}
}});```
This is The Code
i want who do command only can use it
why did you reply "yes" when I ask if you use a collector
I didn't understand you well at the time
can you give me example of filter?
you can use the user id as the custom id and check if custom id equals the user id
no need since you’re using a collector
not a custom id every use her own command
Suggestion for @copper charm:
Interactions: Receiving select menu interactions - Component collectors
read more
this v13?
client.on('interactionCreate', async (interaction) => {
if (!interaction.isSelectMenu()) return;
let messageId = interaction.messageId;
if (interaction.values[0] === 'test') {
let embed = new Discord.MessageEmbed()
.setDescription('**Done**');
await interaction.update({ messageId, embeds: [embed], components: [] });
const collector = interaction.createMessageComponentCollector({ componentType: 'BUTTON', time: 15000 });
collector.on('collect', (i) => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} clicked on the ${i.customId} button.`);
} else {
i.reply({ content: `These buttons aren't for you!`, ephemeral: true });
}
});
collector.on('end', (collected) => {
console.log(`Collected ${collected.size} interactions.`);
});
}
});
it doesn't work
If you want the person who ran the command to be the only one to use it then you can reply using the ephermal: true option and it will only show it to that user. @copper charm
i want it show to everyone and person who ran the command to be the only one to use
It looks like you already did that?
yes but it error
Whats the error?
this
const collector = interaction.createMessageComponentCollector({ componentType: 'BUTTON', time: 15000 });
Oh
it say it error
what can i do
Because it would be <Interaction>.channel.createMessageComponentCollector()
The function is held within the channel object, not the full interaction
it doesn't work but no error
client.on('messageCreate', message => {
if (message.content === "test" || message.content === "-test") {
const embed = new Discord.MessageEmbed()
.setDescription("**To See Test choose**");
let row = new MessageActionRow()
.addComponents(
new MessageSelectMenu()
.setCustomId('select')
.setPlaceholder('Selected')
.addOptions([
{
label: 'Test',
description: 'Test Done',
value: 'test',
emoji: '👍'
}
])
);
message.reply({ embeds: [embed], components: [row] });
}
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isSelectMenu()) return;
let messageId = interaction.messageId;
if (interaction.values[0] === 'test') {
let embed = new Discord.MessageEmbed()
.setDescription('**Done**');
await interaction.update({ messageId, embeds: [embed], components: [] });
const collector = interaction.channel.createMessageComponentCollector({ componentType: 'BUTTON' });
collector.on('collect', (i) => {
if (i.user.id === interaction.user.id) {
i.reply(`${i.user.id} clicked on the ${i.customId} button.`);
} else {
i.reply({ content: `These buttons aren't for you!`, ephemeral: true });
}
});
collector.on('end', (collected) => {
console.log(`Collected ${collected.size} interactions.`);
});
}
});
this is all of code
In your code you're removing all components from the interaction before even running the collector. How are you going to detect if someone clicks a button if there is no button
LOL This Will Work If It Buttom
Yup
how i get one in select
You want it to collect once a user selects something on a selectmenu?
yes
On the original message right?
yes
Uhh you wouldn't be using a collector at all.. You would just run the check on the users ID in the interaction create event instead.
ok How i can get code of users id
You right click on the user and press copy ID
no i mean how i would just run the check on the users ID in the interaction create event instead
By checking <Interaction>.user.id and comparing it to the user ID you want to use
can you give me example please