Adding help thread auto archiver #540
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Discord did some changes to the auto-archive system. They now only hide a channel after the set period and archive it only later (a week). That is a problem for us, since we relied on automatic archival after 24h for our help threads. Without it, they pile up and UX goes down.
Solution
Since Discord does not automatically close our channels properly anymore, we do it ourselves.
This PR adds a simple routine that periodically checks all help threads and archives them if there was no message sent since 24h.
Other
While at it, added a utility for the
handleRequireOverviewChannel
functionality that has been duplicated around 5 times.Same with
getActiveThreadsIn
which also has been duplicated a couple of times.Tests
The solution is well tested. Here are some edge cases (the archive period has been set to 2 minutes for testing):
Keep it alive by sending messages

Reopen after close
