this post was submitted on 04 Aug 2023
5 points (85.7% liked)

Lemmy Bots and Tools

449 readers
3 users here now

Welcome to the programming.dev lemmy development community! This is a place to discuss and show off bots, tools, front ends, etc. you're making that relate to lemmy

Theres another version of this community over at lemm.ee if you want to subscribe to that one as well

Icon base by DarkZaitzev under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Hi folks, so glad this channel is here.

Recently, I:

  • Created a community called fullmoviesonyoutube on lemm.ee
  • Decided I wanted to write a bot to post helpful comments when people post movies there.
  • Created another community called fullmoviesbottesting.
  • Created a user on lemm.ee called fullmoviesbot
  • Wrote and tested the bot from my PC using the lemmy-bot as a starting point, pointing it at that 'fullmoviesbottesting' community, until I was finally pretty happy with it.
  • Updated the bot's code so the federation - allowlist points to 'fullmoviesonyoutube' on the same lemm.ee instance.
  • Ran the bot, created a post with my personal lemmy account.... and nothing happened.

The bot is not creating comments in the new channel. It's like it doesn't see posts created by any other users.

Is there something I need to do to get my bot to recognize posts from other users in the new channel?

I did a test where I logged into lemm.ee in my browser with the bot's user, and created a post and the bot created a comment on that post, but for some reason, that bot-created post doesn't show up in the community. This is that "orphaned" post: https://lemm.ee/post/2896238

I guess another way to ask this - what are the rules for bot's when it comes to creating comments on other user's posts?

EDIT


Here's the full code: https://controlc.com/dd54eae6

(it's rough - don't judge me) Thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] freamon 2 points 1 year ago

Strange Brew is a confusing post to work with - there's 2 of them, one by you, and one by the bot. Typically, when a post is cross-posted to its own community, only one is visible.

It might be easier to ask why the bot replied to Mr Nice Guy and not Fight Club. Only your error logs can tell you this.
There's no rules about who a bot can reply to. I made a reply in the Fight Club post from a bot account using this:

my_instance="https://feddit.nl"

auth="my-jwt-string"
post_id=1232490				# feddit.nl's version of the post

API="api/v3"
content="Sigh. Yet another Mr Robot ripoff"

create() {
        end_point="comment"
        json_data="{\"auth\":\"$auth\",\"post_id\":$post_id,\"content\":\"$content\",\"language_id\":37}"

        url="$my_instance/$API/$end_point"

        curl -H "Content-Type: application/json" -d "$json_data" "$url"
}

create