diff --git a/index.ts b/index.ts index 69dc945..c50ca75 100644 --- a/index.ts +++ b/index.ts @@ -41,6 +41,9 @@ const sleep = (msec: number) => // #region misskey const me = await misskey.request("i", {}); +const isSuitableAsInput = (n: Note) => + !n.user.isBot && !n.replyId && (!n.mentions || n.mentions.length === 0) + /** randomly sample some notes from the timeline */ async function getNotes() { // randomly sample N local notes @@ -51,7 +54,7 @@ async function getNotes() { limit: 100, }); // exclude bot notes - return sample(timeline.filter((p) => !p.user.isBot), count); + return sample(timeline.filter(isSuitableAsInput), count); } // randomly sample N global notes @@ -62,7 +65,7 @@ async function getNotes() { limit: 100, }); // exclude bot notes and replies - return sample(timeline.filter((p) => !p.user.isBot && !p.reply), count); + return sample(timeline.filter(isSuitableAsInput), count); } // randomly sample N notes of mine