'TypeError: 'str' object is not callable when creating reddit bot
I am trying to build a reddit bot that comments when one of the phrases is commented, but It doesn't work
import praw
import time
reddit = praw.Reddit(
client_id='---',
client_secret='---',
user_agent='---',
username='---',
password='---')
subreddit = reddit.subreddit("okbuddyreiner")
quote = "I want to kill myself"
for submission in subreddit.hot(limit=10):
print("**********")
print(submission.title)
for comment in submission.comments:
if hasattr(comment, "body"):
comment_lower = comment.body.lower()
if " lainah " in comment_lower:
print("--------")
print(comment.body)
comment.body(quote)
time.sleep(660)
if " reiner " in comment_lower:
print("--------")
print(comment.body)
comment.body(quote)
time.sleep(660)
after that I get this error, and I cannot fix it, I have tried everything
Traceback (most recent call last):
File "/home/Lainahbot/reddit_bot.py", line 26, in <module>
comment.body(quote)
TypeError: 'str' object is not callable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
