Collector filter editing after creation

So I have an embed with buttons (panel) and each voice channel has one panel to itself. I've filtered the panel using the channelId so that someone in voiceChannel2 can't interact with voiceChannel1 panel. My collector + filter code:
const filter = i => [`lock-${buttonChannelId}`, `unlock-${buttonChannelId}`, `comeplay-${buttonChannelId}`, `edit-name-${buttonChannelId}`, `stage-${buttonChannelId}`, `end-stage-${buttonChannelId}`, `ban-${buttonChannelId}`, `finish-${buttonChannelId}`, `editNameModal-${buttonChannelId}`].includes(i.customId);
const collector = sendEmbed.createMessageComponentCollector({ filter, time: null });
const filter = i => [`lock-${buttonChannelId}`, `unlock-${buttonChannelId}`, `comeplay-${buttonChannelId}`, `edit-name-${buttonChannelId}`, `stage-${buttonChannelId}`, `end-stage-${buttonChannelId}`, `ban-${buttonChannelId}`, `finish-${buttonChannelId}`, `editNameModal-${buttonChannelId}`].includes(i.customId);
const collector = sendEmbed.createMessageComponentCollector({ filter, time: null });
buttonChannelId is the channelId The new problem I have is one of the buttons (stage), makes a stage and deletes the voice channel and moves all the users into that stage. During this process I assign the new channel Id value to the buttonChannelId variable. That value changes within the collector itself, but the problem I have is, that value doesn't change in the filters for the collector. So it ignores all buttons from the panel after it becomes a stage. What can I do? (Apologies for rambling on, I wanted to explain my situation with as much detail as possible)
2 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Post the full error stack trace, not just the top part! - Show your code! - Explain what exactly your issue is. - Not a discord.js issue? Check out #useful-servers.
victorr
victorrOP2y ago
I don't think that's really viable unless there's a way to restart the same collector because theres another button to revert the stage channel back to a voice channel Is it possible to just remove the filter? Because once the collector is on I'm again filtering the specific interactions Yeah I understand that but I don't have a way around it, the person who wants the bot wants the buttons to be active as long as the voice channel has members in it. I believe it would not be viable because I have a loop from voice channel to stage and stage to voice channel and so on. Is there a way to restart the first collector (voice channel) once the user has clicked the end-stage button rather than make a new collector? It's like one of those join to create hubs, and there's multiple voice channels I will be disabling the panel buttons once the channel gets deleted (when it's empty) Let me explain a bit better; So if someone clicks the stage button, you want me to make a new collector (stage channel collector) The collector will have more or less the same features as the previous collector (voice channel collector) My problem is here: If the user clicks the end-stage button and I make another collector which is exactly the same as the first collector. Can I just use the first collector? Or else is there any other way without making multiple collectors? Wait hang on a second, I might be being stupid, if I make another collector within the first collector. Then the first collector should still work right?
Want results from more Discord servers?
Add your server