richfromm / slack2discord

A Discord client that imports Slack-exported JSON chat history to Discord channel(s).
GNU General Public License v3.0
8 stars 3 forks source link

Deal with discord active thread limit #33

Open richfromm opened 1 year ago

richfromm commented 1 year ago

While researching https://github.com/richfromm/slack2discord/issues/32, I came across yet another unexpected limit.

https://support.discord.com/hc/en-us/community/posts/360056762431-Increase-channel-limit?page=2#community_comment_4416922099351 claims:

1: Yes, there is a limit of 1000 ACTIVE threads, but you can have an unlimited amount of archived threads.

I have not seen any documentation of this (although plenty of other limits are also undocumented), nor have I tried to replicate it.

Perhaps we should explicitly archive threads when creating them during the import? Or maybe only if they are sufficiently old? And/or maybe only if we are in danger of hitting the limit ? (See Guild.active_threads(), I think we'd need to fetch all of the active threads and count how many there are.)

Note that I'm not entirely sure how to archive a thread via the API. I don't see any kind of archive() method on the Thread class. There is an archived attribute, it's not clear whether that's read-only, or if I can archive a thread just by setting that.

Another related attribute is auto_archive_duration, although again it's not clear if that can be changed by just setting that. Note that the Message.create_thread() method used to create the thread (called on the message that's the root of the thread) does have a parameter auto_archive_duration. (If not provided, a channel default value is used.) But this is measured in minutes. If we're close to the limit, even setting it to 1 minute might not be sufficient unless we substantially artificially slow down the importing of data to Discord. I'd have to test if 0 is a legal value and if that would force the thread to be immediately archived on creation. But even if that worked, would it persist? That is, after creating the thread, would each new message added to the thread in the import cause it to be unarchived? If so, would that be okay if a setting of 0 then caused it to be immediately re-archived?

The bottom line is that some further investigation and testing is required.

richfromm commented 1 year ago

Attn: @waocats @shmulvad

waocats commented 1 year ago

That is, after creating the thread, would each new message added to the thread in the import cause it to be unarchived?

Seems so. Since you have access to the channel, you could change the channel-wide value to remove them from the sidebar, and then set it back to its previous value once you're done (or perhaps a bit earlier to account for newer threads).