setInterval in an event
I would like the event to be executed every 30 seconds but somehow it does nothing and does not throw an error.
24 Replies
how you're getting
interaction
in that function? btw you could simply put it in your index.js with cron OR loop it in ur client.on('ready')
.I also wonder how I get the interaction in it and I could put it in my Index.js but I actually want it all organized at the events so that it is clearer
Are you waiting out the full 30 seconds for the setInterval to run?
actually I want him to do this every 30 minutes but for testing it is 30 seconds for now
I think my mistake is with the Chanel determine with the interaction but I do not know how I can fix that
but eigendlich even if the channel can not be determined it should give me an error a
and I've been waiting the whole 30 seconds
but I think the error is in the name because it has to be triggered somehow but I don't know how it's not as easy as 'guildMemberAdd'
I tried 'apiResponse' as name but it didn't work either because of de, interatction
You can just use a function for that and set it on a loop
and then set an interval for every 30s to this in ur ready event as Amirh said
Also
instead of interaction
use client
idk how u got interaction working there but u can
ignore that mb
just get the channel by ID
and then send it there
so I'll leave it in the foulder event
I just don't understand what you mean exactly
can you give me an example code so i can understand it
that works now now i only have the problem with the channel
The client itself has a channels cache
Client looks like it’s undefined
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
In the ready Event With a Loop Right ?
Oh, so he already restarts the interval itself after the certain time?
that still has the problem
yes
oh thank you man do you have an idea how i don't delete a certain message in the channel as if it were pinned
and how do I do that I get all the messages id and insert them there
is there a function that stops bulkdelete on any message? or that he does not delete the messages from certain users or from himself
Yes, I understood, but I don't understand how I can implement it
with actually all but above all to get and save the ids of the messeges
Documentation suggestion for @profdrjoni: Collection#filter()
Identical to Array.filter(), but returns a Collection instead of an Array.
Yes, the 10th was just to try it out. I would actually like to have a channel where every 30 minutes everything except the embed is deleted by the bot
but then the embed will be deleted or not
oh okay thx i try it later I have to go to an appointment now
like that or does a foreach have to be added?
like so ?
so all will be deleted except the ones that are pinned, right?
yes this works thx man