PRAW Comment and Sticky

Question:

I want to comment to a post, and sticky it straight away:

for submission in sub:
    if (submission.is_video or os.path.splitext(submission.url)[-1] in [".gif", ".gifv", ".mp4", ".webm"]) and submission.id not in get_old_submissions():
        submission.reply(MESSAGE)

I’ve tried iterating through the submissions comments, checking if the body is equal to the message, but my comment doesn’t seem to show up at all:

        print(submission.comments.list())

Just gives []. Is there perhaps an easy way of getting the id of the new comment so I can pin it straight away?

Answers:

.reply() returns a Comment object, so you can just assign that to a variable and then sticky it:

comment = submission.reply()
comment.mod.distinguish(sticky=True)
Answered By: timawesomeness

@timawesomeness I tried that and it gave the error

reply() missing 1 required keyword-only argument: 'body' 

(would comment but I don’t have 50 reputation)

Answered By: Jack Green
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.