r/botwatch • • May 04 '15

Multi Line Comments

I'm not sure why this isn't working... Would you mind taking a look at this code? I'm simply trying to post a 6 line comment, however nothing I try is working. Posting a single line works fine however.

dad1 = "1"
dad2 = "2"
dad3 = "3"
dad4 = "4"
dad5 = "5"
dad6 = "6"

dadPoem = dad1 + '\n' + dad2 + '\n' + dad3 + '\n' + dad4 + '\n' + dad5 + '\n' + dad6


def run_bot():
    print "Grabbing subreddit..."
    subreddit = r.get_subreddit("test")
    print "Grabbing comments..."
    comments = subreddit.get_comments(limit=100)
    for comment in comments:
        comment_text = comment.body.lower()
        isMatch = any(string in comment_text for string in dadJoke)
        if comment.id not in cache and isMatch:
            print "Match found!  Comment ID: " + comment.id
            comment.reply(dadPoem)
            print "Reply Succesful!"
            cache.append(comment.id)
    print "Comment loop finished, sleeping for 30s..."

My expectation is that this would print: 1 2 3 4 5 6

What am I missing?

0 Upvotes

4 comments sorted by

3

u/GoldenSights Moderator May 04 '15

My expectation is that this would print: 1 2 3 4 5 6

You did it, too. On reddit you have to use two \n\n to get a single break. You can also put two spaces on the end of the line to get a smaller break

line1

line2

↓

line1

line2

 

"line 1  "
"line 2  "

↓

line 1
line 2

3

u/some_lymric May 04 '15

THANK YOU SOOOOO EFFING MUCH!!!! I seriously spent hours trying to figure this out! I was driving myself crazy! I can't believe I overlooked such a simple mistake!

YOU ARE THE MAN!

2

u/GoldenSights Moderator May 04 '15

Wow, thanks!

3

u/some_lymric May 05 '15

No, thank you! I was seriously getting freaked out! lol

And you helped me without being a jerk lol