zigdon / xkcd-Bucket

Bucket is the channel bot for #xkcd
http://wiki.xkcd.com/irc/Bucket
121 stars 31 forks source link

Can't trigger factoids containing : without whitespace preceding it #76

Closed dgw closed 8 years ago

dgw commented 8 years ago

Clearly something to do with how Bucket strips off the first bit for use as $to in the tidbit. With #75 enabled on my instance, pinning this down was pretty easy.

What's less clear is the way ahead. For my particular case it would work simply to avoid stripping off the first part of the line if there's no space following the colon…but what of legitimate triggers of the form Word: More Stuff?

Basically, is it worth e.g. checking to see if the potential value of $to is in the channel before stripping it from the line start? Or have I crossed into truly esoteric territory that should be left alone?

zigdon commented 8 years ago

Don't we already keep a list of channel membership, for use in $someone? In that case, checking to see if the addressee is in that list shouldn't be too bad.

dgw commented 8 years ago

I put together an implementation of that solution, and a couple quick tests show it's working. I'll let it stew in production for a while before posting a PR, per usual, to shake out as many bugs as I can.

dgw commented 8 years ago

Probably good that I didn't PR/merge my implementation yet… I'm having trouble triggering factoids with the $to mechanism while running this patch, I think. More work needed…

Edit: Traced it to me being an idiot and trying to reinvent a wheel already supplied by the IRC component. Time to rewrite and retest.

dgw commented 8 years ago

Testing a new, simpler implementation. It's all committed and ready to PR once I put it through another week or two of testing—probably two, since it took me that long to find the bug in my original naïve implementation. (I haven't squashed the branch yet, so all those commits that reference this issue are the broken implementation, sadly. I forgot the issue reference was in there.)