#Deleted 5 days after the last post in the thread

9 messages · Page 1 of 1 (latest)

smoky rampart
#

I tried code like this but it didn't work.

var thread_counter = {}

client.on("threadCreate", async (thread) => {
    await thread.send(`Deleted 2 days after the last post in the thread `);
    thread_counter[thread.id] = 1
    setTimeout(function () {
        if (thread_counter[thread.id] = 1) {
            thread.delete()
        }
    }, 432000000);
});

client.on('threadUpdate',async (old_thread,new_thread) => {
    thread_counter[old_thread.id] += 1;
    const thread = thread_counter[old_thread.id]
    setTimeout(function () {
        if (thread_counter[old_thread.id] = thread) {
            thread.delete()
        }
    }, 432000000);
});

i am using translation.

#

• 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.

#

Deleted 5 days after the last post in the thread

#

The thread will be deleted after the specified time has passed, but it will not be updated even if a message is sent, and will be deleted 5 days after the thread was created.

thorny marten
#

You dont remove the old timeout

gleaming basinBOT
#

mdn setTimeout()
The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.

smoky rampart
thorny marten
#

Not djs related