joeyvanlierop / xkcdbot

A reddit bot that automatically links xkcd comics in the /r/xkcd subreddit 🤖
MIT License
37 stars 20 forks source link

Truncation of comment body and changes to matching of comic numbers #26

Closed stefanosporiazis closed 4 years ago

stefanosporiazis commented 4 years ago

As discussed in #1, the bot should only handle up to a certain amount of characters to prevent any kind of overload.

Also, since as of today the number of xkcd comics is less than 2500, the regex shouldn't match any ridiculously large numbers as that could cause issues for no reason.

So in order to address these two issues, I truncated the body's length to 5000 and I changed the regex so it will only match numbers up to 6 digits long. Which should be more than enough and it's also a fairly small number for Python to handle.