包括上面评论的用户名在回复机器人与普拉

2024-04-27 00:30:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用PRAW开发一个Reddit机器人,我想在它的回复中有机器人回复的人的用户名。你知道吗

for comment in comments:
    comment_text = comment.body.lower()
    isMatch = any(string in comment_text for string in words_to_match)
    if comment.id not in cache and isMatch:
        print("Comment match found;" + comment.id)
        comment.reply('Hello + author.name')
        print("Reply successful!")
        cache.append(comment.id)

但是,这不起作用,它只是像预期的那样以文本形式回复。可以用评论的用户名回复,然后再加上更多的文本吗?你知道吗


Tags: textin文本idcacheforstringmatch