alexames / DeltaBot

GNU General Public License v3.0
65 stars 18 forks source link

DeltaBot replied to a message that had deltas in a reddit quote. #38

Closed Snorrrlax closed 10 years ago

Snorrrlax commented 10 years ago

See here: http://www.reddit.com/r/changemyview/comments/1tyi4y/reddit_on_mobile_is_far_superior_to_the_actual/cecrlwq

DeltaBot left the distinguished comment explaining that OPs can't earn deltas. The user pointed out that the deltas were in a reddit quote. This should be completely ignored.

CheshireSwift commented 10 years ago

I've identified the replication steps. Looks like DeltaBot doesn't complain about deltas on the same line as a leading > (i.e. in a quote), however if the user splits the quoted text over multiple lines with only a single > (still a reddit quote, since you need a double line break to end the paragraph) the bot will complain.

I'm off to bed now, but I'll whip up a fix tomorrow.

Chillee commented 10 years ago

I submitted a pull request. I changed

for line in lines:
        if not skippable_line(line):
            for token in tokens:
                if token in line:
                    return True
    return False

to

for line in lines:
        if(line==''):
            in_quote=False
        if in_quote:
            continue
        if not skippable_line(line):
            for token in tokens:
                if token in line:
                    return True
        else:
            in_quote=True
    return False
PixelOrange commented 10 years ago

Closed due to issue #58