shaunagm / WelcomeBot

Other
35 stars 43 forks source link

Bot fails when given certain ircmsg inputs #18

Closed shaunagm closed 10 years ago

shaunagm commented 10 years ago

Branched from a previous issue: https://github.com/shaunagm/oh-irc-bot/issues/10

Every couple of weeks, WelcomeBot goes offline. The error messages all seem to look like this: File "data/bot.py", line 98, in actor = ircmsg.split(":")[1].split("!")[0] IndexError: list index out of range

The input that appears to have caused this looks something like this:

ERROR :Closing Link: 87.98.215.226 (Ping timeout: 265 seconds)

It's not clear to me what's causing the index out of range. Split returns a list of size 1 or greater (I believe) so doing split("!")[0] should be fine, even if there's no ! in the string (as appears to be the case above). And the input above does have several ":" so the [1] shouldn't be out of range either. Maybe this is the wrong input somehow?

If we can't figure out how in particular this is being broken, we can perhaps still solve it by inserting a try:except statement around line 98. I don't think that we actually need to address whatever this rare, break-ing message is - we can just insert some nonsense that doesn't match any of the .find()s in the rest of the loop.