Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reply_root event #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

richie3366
Copy link

I wanted my bot to be able to intercept all replies made below its own posts, regardless of their parent-post.

This PR adds the ability to listen to those kind of replies, without interfering with the reply event, and without duplicate issues since reply takes precedence.

Possible problems: it will take precedence over quote & mention if someone happens to quote/mention the bot account in a reply inside a thread initiated by the bot. Note: The same behavior was already happening with the reply event.

I implemented the event into the polling interceptor as well. I took care to still ignore non-direct replies which are made to threads not initiated by the bot: it can happen when the bot has participated inside a thread and someone replies to a replying post.

Other minor fixes: I replaced includes with startsWith (it's more appropriate to what it's supposed to do, and it's way more efficient; we're inside a Jetstream event handler so it does matter). I also added a / after the did, because, apart from PLC DIDs, they do not have a fixed length.

I am opened to any suggestion, including about the event name, I didn't find any naming convention. I could have used a hyphen instead of an underscore. Please suggest away if you happen to think of a better event name. Btw, edits by maintainers are allowed.

@richie3366 richie3366 changed the title Add reply root Add reply_root event Nov 24, 2024
@futurGH
Copy link
Contributor

futurGH commented Nov 24, 2024

Thanks for the PR! I'm hesitant to merge this because the Bluesky docs recommend that bot accounts should only respond to users who have directly interacted with them first. I'm sure there are use cases for handling nested replies where that is honoured, but I'm not sure I want to make the option available by default, since most users won't read the docs.

@richie3366
Copy link
Author

richie3366 commented Nov 24, 2024

While I do understand your hesitation (which is well justified), I believe it's up to the devs to act responsibly. And malicious actors won't stop because some package decided to prevent them to do so (but that's not a reason to purposely make their life easier regardless). Plus, this event would (& imo should) be isolated from the already existing reply event, so devs should be aware of what they are doing when listening to that event. But I'm probably biased. x)

(If you are curious about my use case)
My use case is: I'm currently re-making an old Twitter bot I originally made in 2015, and during the early days, it was only replying to direct replies, but users were confused because sometime they replied to themselves or other players to propose a new word to play. So I made it reply to any mention (which is not explicitely the case for Bsky replies). The bot was never flagged as inappropriate by Twitter before it had to be deactivated because of the paid API.

@richie3366
Copy link
Author

richie3366 commented Nov 24, 2024

(sorry for the double comment, I just thought about another perspective)
Only an opinion, but I believe that a user participating in a thread published by a bot account should count as an interaction initiated by a human. The post appeared to them either because they followed the bot (human action), or because they saw a following play with it (human action). They are matter-of-factly interacting inside a bot scope/space.

And in the case of my bot, the precaution I'm willing to make is: only consider replies which consist of no more than one word of length greater than 5 letters (to avoid congratulating replies like "bravo", "GG", etc. as much as possible). And also avoid replies to threads which are not the current active one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants