Skip to content

Commit 067ef74

Browse files
committed
chore: filter payload bot messages
1 parent bf8bdf2 commit 067ef74

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

src/components/DiscordGitCTA/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const DiscordGitCTA: React.FC<{ appearance?: 'default' | 'minimal' }> = (
3939
<p className={classes.license}>
4040
Get dedicated engineering support{' '}
4141
<Link className={classes.button} href="/talk-to-us" prefetch={false}>
42-
directly from the Payload team.
42+
directly from the Payload team
4343
</Link>
4444
.
4545
</p>

src/scripts/fetchDiscord.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,21 @@ function createSanitizedThread(thread: Thread, messages: Message[]) {
140140
}
141141
: {},
142142
messageCount: combinedResponses.length,
143-
messages: combinedResponses.map(({ attachments, author, content, timestamp }) => ({
144-
authorAvatar: author.avatar,
145-
authorID: author.id,
146-
authorName: author.username,
147-
content: toHTML(content),
148-
createdAt: new Date(timestamp),
149-
fileAttachments: attachments,
150-
})),
143+
messages: combinedResponses.map(({ attachments, author, content, timestamp }) => {
144+
if (author.username === 'Payload-Bot') {
145+
// Skip Payload bot messages
146+
return
147+
} else {
148+
return {
149+
authorAvatar: author.avatar,
150+
authorID: author.id,
151+
authorName: author.username,
152+
content: toHTML(content),
153+
createdAt: new Date(timestamp),
154+
fileAttachments: attachments,
155+
}
156+
}
157+
}),
151158
ogMessageCount: thread.message_count,
152159
}
153160
}

0 commit comments

Comments
 (0)