#Deleted 5 days after the last post in the thread

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