#Help
1 messages · Page 1 of 1 (latest)
share your code
this is my code so far, the important part is on the very end. i want it to delete the room ONLY if the user has not replied anything AT ALL after one hour
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
because right now if anyone replies to the new channel, the bot will recognize it and it won't be closed after 1h
it should apply only to the interaction.user
so anyone can reply, but if the interaction.user has not replied anything, then delete
if he has replied, don't delete
hope you get me haha
yea i get you, its kinda to really related to discord.js but im taking the freedom of being on a thread
you need to have some internal timers, but this is like my idea though, gimme a couple of secs while i log in on my computer
sure, thank you for helping me out 🙏
are you familiar with nodejs timers?
more or less, yes
so basically you dont want the channel to be deleted after one hour but rather be deleted if the user that used the interaction hasn't sent a message after 1 hour from their last one
exactly
if he just opened an "application"
and said nothing in the newly created room in one hour
delete it
okay so I think this is simpler than it seems at first, im trying to see if this would work, im too lazy to test...
first after you create the channel, you could create the first timeout like this
let deleteChannelTimeout = setTimeout(() => {
// whatever you want to do if the channel has to be deleted
c.delete("No response");
}, waitAmount);```
So what i would do is, after you create the channel, create a messageCollector on the channel like this
`c.createMessageCollector().on('collect', message => {`
then inside the collector, check `if (message.author.id === interaction.user.id) {`, if this is true it means the user who issued the interaction sent a message to this channel, so we can reset the timer clearing the timeout ` clearTimeout(deleteChannelTimeout);` and then creating a resetting it like this
`deleteChannelTimeout = setTimeout(() => { c.delete("No response given within 1 hour") }, waitAmount);`
in my head this should work, that doesn't mean in practice it will, but you can get an idea out of this, just make sure you clear the timeouts correctly otherwise it will go to shit
this would only be for the part of them not sending a message for one hour in the channel