HugoNikanor/reddit-parenthesis-bot

Limit parenthesis count

Closed this issue · 4 comments

Most genuine posts will have a limited number of parentheses anyhow, so I would suggest limiting the maximum number of parentheses the bot will react to. Something like fifteen or twenty should cover it, easy. In cases where this limit is broken, either reply with a generic "parenthesis limit reached" message or don't reply at all.

With regards to the specific number: the ideal would be a sane default that can be overridden on request. Of course the whole handling of those requests would require some work if it is to be automated on request of moderators.

As moderator of /u/ProgrammerHumor I would personally be fine with say fifteen. I'm mostly concerned with screen space and not if that number is feasible to reach by a genuine post.

Note: I take 'genuine post' to informally mean a post not specifically crafted to provoke a response from the bot.

This deffinitly is something of importance, and 15 opening parenthesis sounds like a reasonably amount.

Allowing a manual override of this limit would require a bunch extra code. And that's something I rather not look into, with the codebase looking like it does.

I'm currently working on limiting the response. Whene there is more than 15 parenthesis in the post the bot constructs a special "anti-spam" response instead of the usual, as can be seen here.

Here is the code responsible for the change.

Change now merged into master. @tskaiser notify me if there is any problem with the new arrangement, especially in the forms of spam.