enumeration - increment number in reddit python bot reply -
i'm trying make bot increments number every time mentions string. far can increment once , every other reply stays @ same number. declared @ 2017, reply 2018 when finds string. know small i'm missing cant figure out.
for comment in r.subreddit('test').comments(limit = 500): mentions = 2017 if "string" in comment.body , comment.id not in comments_replied_to , comment.author != r.user.me(): mentions +=1 print ("string found!") , comment.id comment.reply(" delayed until year" + str(mentions)) print("replied comment")
you're declaring mentions
inside body of loop, meaning set 2017
on every iteration.
also, print ("string found!") , comment.id
should print("string found!", comment.id)
.
Comments
Post a Comment