mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-08-13 14:03:01 -06:00
Skip empty THREAD_STARTER_MESSAGE placeholder in thread exports
A thread created from a message has an empty THREAD_STARTER_MESSAGE (type 21) placeholder at the top of its history that just points back to the originating message. Now that the actual starter message is fetched and exported separately, this placeholder is redundant noise, so skip it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f9a800e667
commit
38f9b9c676
|
|
@ -13,4 +13,5 @@ public enum MessageKind
|
|||
GuildMemberJoin = 7,
|
||||
ThreadCreated = 18,
|
||||
Reply = 19,
|
||||
ThreadStarterMessage = 21,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,13 @@ public class ChannelExporter(DiscordClient discord)
|
|||
// Fetch the rest of the thread's history and yield messages one by one
|
||||
await foreach (var message in messages.WithCancellation(innerCancellationToken))
|
||||
{
|
||||
// A thread created from a message has an empty THREAD_STARTER_MESSAGE placeholder
|
||||
// at the top of its history that merely points back to the originating message.
|
||||
// It never carries any renderable content of its own and is superseded by the
|
||||
// actual starter message fetched above, so skip it.
|
||||
if (message.Kind == MessageKind.ThreadStarterMessage)
|
||||
continue;
|
||||
|
||||
// Avoid exporting the starter message twice in case it's also returned as part
|
||||
// of the thread's own history.
|
||||
if (message.Id != starterMessage?.Id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue