[PRAW] Getting parent comments?

PRAW

I have a bot who I want to give the functionality to delete their own comments. I want it to see if it's told to delete a comment, check that the person telling it to delete is the author of the parent comment, and delete. At the moment it's basically pseudocode that reads like:

    for msg in r.inbox.all(limit=3):
        if msg=="DELETE":
            msg.parent.body=mine
            msg.author=author
            if mine.parent.author==author:
                print("bloop") #this is just a test to inform me if it gets this far. It hasn't yet.
                r.delete(mine)
                print("A comment was deleted.")

Example:

^OP

blah blah blah

^Bot

Response

^OP

DELETE

And then my bot should go back and delete "Response".

So how should I go about determining the comment author and parent comment?

Posted Jun 16, 2017, 7:36 PM UTC · edited

25
Loading comments…