Giter VIP home page Giter VIP logo

Comments (2)

SleeplessOne1917 avatar SleeplessOne1917 commented on July 27, 2024

What is parentId in this case? I tried to reproduce what it appears you're doing with the following code:

import { CommentView, LemmyBot, PostView } from "lemmy-bot";

const bot = new LemmyBot({
  instance: "localhost:8536",
  credentials: { username: "muhbot", password: "lemmylemmy" },
  handlers: {
    comment: async ({ botActions, commentView }) => {
      if (commentView.comment.content.includes("remove")) {
        const parent = await botActions.getParentOfComment(commentView.comment);

        if (parent.type === "comment") {
          await botActions.removeComment({
            comment_id: (parent.data as CommentView).comment.id,
            reason: `Requested by ${commentView.creator.name}`,
          });
        } else {
          await botActions.removePost({
            post_id: (parent.data as PostView).post.id,
            reason: `Requested by ${commentView.creator.name}`,
          });
        }
      }
    },
  },
});

bot.start();

The bot removed posts and comments as expected. If you could make a minimal reproducible example of your issue, that would be very helpful.

from lemmy-bot.

SleeplessOne1917 avatar SleeplessOne1917 commented on July 27, 2024

@tubbadu This is from several versions of both this library and lemmy's api ago. Do you still run into the issue?

from lemmy-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.