feat: show found words in embed
willow hai@wlo.moe
Tue, 22 Jul 2025 12:46:11 +0100
1 files changed,
5 insertions(+),
2 deletions(-)
jump to
M
src/utils/forumWatcher.ts
→
src/utils/forumWatcher.ts
@@ -141,12 +141,14 @@ "exploits",
]; for (const post of newPosts) { - const includesWord = flaggedWords.some( + if (!post.firstComment || !post.firstComment.content) continue; + const foundWords = flaggedWords.filter( (word) => post.name.toLowerCase().includes(word) || post.firstComment.content.plainText.toLowerCase().includes(word), ); - if (!includesWord) continue; + if (foundWords.length === 0) continue; + const postLink = `https://roblox.com/communities/${forumConfig.groupId}/${forumConfig.groupName}#!/forums/${forumConfig.channelId}/post/${post.id}`; const postContainer = new ContainerBuilder();@@ -182,6 +184,7 @@
const footerParts = [ `user id: ${inlineCode(String(post.createdBy))}`, `posted <t:${Math.round(new Date(post.createdAt).getTime() / 1000)}:R>`, + `matched words: ${foundWords.map((word) => inlineCode(word)).join(", ")}`, ]; const postFooter = new TextDisplayBuilder().setContent( `-# ${footerParts.join(" • ")}`,