From 5fdef65846211cb1a474ca4527024a3aeebef51f Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Mon, 25 Aug 2025 16:51:21 +1000 Subject: [PATCH] Doesn't reply to replies, because that would get messy and I don't want the bot giving me another pattern when I reply to one of its posts --- poptimal.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/poptimal.js b/poptimal.js index ce920bf..ed0da34 100644 --- a/poptimal.js +++ b/poptimal.js @@ -207,18 +207,23 @@ async function send_replies(argv, cf) { created: s.created_at, status_id: status.id, account: account.acct, - url: status.url + url: status.url, + in_reply_to_id: status.in_reply_to_id }; }); const newmentions = mentions.filter((m) => !oldids.includes(m.id)); for (const mention of newmentions) { - console.log(`new mention ${mention.id}`); - const reply = { - id: mention.status_id, - account: `@${mention.account}` - }; - - post(argv, cf, reply); + if( mention.in_reply_to_id ) { + console.log(`won't reply to ${mention.id} as it's a reply to ${mention.in_reply_to_id}`); + } else { + console.log(`new mention ${mention.id}`); + const reply = { + id: mention.status_id, + account: `@${mention.account}` + }; + + post(argv, cf, reply); + } } if( !argv.n ) { await promises.writeFile(cf.mentions, JSON.stringify(mentions, null, 4));