|
With a regular expression trigger, in fact, I could simply look for channel
traffic that even vaguely *mentioned* cats or dogs, or kittens and puppies,
or expressions of cuteness, or whatever.
As this developed I had to handle minor special cases like sentences beginning
with the key words, punctuation afterward, and minor other variants, but with
this simple setup the bot would handily respond with a cat or dog fact
whenever someone commented on either.
Except that was far too frequently, as seen in the main-story image, where
the bot was even picking up multiple triggers from within one message.
To avoid it turning into a total spam-fest, the final code added a simple
randomizer so that the quote responses would only fire about half the
time, and after a short delay to make it a little less clear why.
I could also wrap the quote in a little extra markdown to explain why
these random sends from a bot were coming in at all.
And the best part?
Custom commands don't need any special privilege to invoke, as it
technically isn't a direct bot command.
So this would work for everyone.
|