Hello fellow Lemmings! I’m trying to develop a Lemmy bot that reads posts and comments using the lemmy-bot library. So I created a new Node.js project, installed the library, and wrote this:

import LemmyBot from 'lemmy-bot';

const LEMMY_USERNAME = process.env.LEMMY_USERNAME;
const LEMMY_PASSWORD = process.env.LEMMY_PASSWORD;
const LEMMY_INSTANCE = process.env.LEMMY_INSTANCE;

const bot = new LemmyBot.LemmyBot({
  // Pass configuration options here
  credentials: {
    username: LEMMY_USERNAME,
    password: LEMMY_PASSWORD
  },
  instance: LEMMY_INSTANCE,
  federation: "all",
  dbFile: 'db.sqlite3',
  handler: {
    comment: {
      handle: ({
        commentView: {
          comment: { creator_id, id }
        },
        botActions: { createComment }
      }) => {
        console.warn("new comment:")
      }
    },
    post: {
      handle: (x) => {
        console.warn("new post", x)
      }
    }
  }
});

bot.start()

and then I run it: node index.js
this is the output:

Connected to Lemmy Instance
Initializing DB
Logging in
Marking account as bot account
Subscribing to communities

and then stops there. I waited a lot and nothing, not a single log. credentials are correct, because otherwise it wouldn’t login. the bot is using an account hosted on sh.itjust.work, so there should be plenty of activity (I tried adding comments manually but nothing was detected)

What am I doing wrong?

thanks in advance

  • F04118F@feddit.nl
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I noticed in my account settings, there is a tickbox “is bot”. Perhaps try setting that to true or false on the account you are using?