PRAW评论和置顶

时间:2018-11-22 18:21:08

标签: python praw

我想评论一则帖子,并立即将其粘贴:

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)

我尝试遍历提交的评论,检查正文是否等于邮件,但我的评论似乎根本没有出现:

        print(submission.comments.list())

只需给出[]。也许有一种简单的方法来获取新评论的ID,以便我可以立即将其固定?

1 个答案:

答案 0 :(得分:1)

.reply() returns a Comment object,因此您可以将其分配给变量,然后分配给sticky it

comment = submission.reply()
comment.mod.distinguish(sticky=True)