Answer the question
In order to leave comments, you need to log in
How can I make it run only 1 interval?
I want the bot to write "done" to the chat every 10 seconds after a certain command, but if I write the command 2 times, then after 10 seconds the bot writes "done" 2 times and it turns out that 2 intervals are running, but I only need 1.
Example:
bot.on('message', async message => {
function log {
client.channels.cache.get("id_channel").send("done")
};
let interval = setInterval(log, 10000);
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question