#MessageComponentCollectorSearchCommand

1 messages · Page 1 of 1 (latest)

sand furnace
#

cause creating a messageComponentCollector like this interaction.createMessageComponentCollector({}) it says its not a function, obviously

#

so im trying to assign the last edited message to a variable like:

var tempmsg = interaction.editReply({})

#

and then it does not work either?

#

idk

narrow violet
#

Could I see the code for your collector?

sand furnace
#
const filter2 = (interaction) => interaction.customId === 'button';
          const collector = context.createMessageComponentCollector({
               filter2,
               time: 30000
          })


          collector.on('collect', async button => {})

Still trying something with filter cause its my first time creating a collector like this :)

#

and i got it with the editing part. i was dumb.

narrow violet
#

const collector = context.createMessageComponentCollector({ componentType: 'BUTTON', time: 30000 });

#

I think that is what you'll need to do to create the collector

sand furnace
#

so no filter needed? cause i dont know what to filter for xd

narrow violet
#

You'd probably want to use a filter to make sure that the collector is only listening for the user who created the interaction

sand furnace
#

dont need that cause the interaction is ephemeral

#

right?

narrow violet
#

But since it's ephemeral you should be fine

#

Yeah

#

Then you can do something like this to listen to what's collected

collector.on('collect', i => {
    // your code here
});```
sand furnace
#

does this now work?
or is it simpler your way

#

its the same i just noticed

#

mb

narrow violet
#

How come you have collector.stop() and button.deferUpdate()?

#

the switch case looks fine though

sand furnace
#

does collector.stop not work?

narrow violet
#

Assuming you've given your buttons the id's of 1 through 5

sand furnace
narrow violet
#

collector.stop() will stop the collection

sand furnace
#

i think collector.stop is fine not?

Yes its what i want

#

and then i can use

collector.on('end', i => {
    // your code here
});

narrow violet
#

Oh, okay

#

Try put your code in to one of the cases

sand furnace
#

i saw from somebody the button.defer thing

#

so idk if its even supposed to be there lmao

sand furnace
narrow violet
#

That seems promising

#

Hopefully you should be able to use interaction.editReply() to edit the original response based on the buttons pressed now

sand furnace
#

ok i'll try

#

but thank you so much

sand furnace
#

does a collector need to be stopped at some point?