From: Paul L. A. <pl...@so...> - 2004-08-03 15:23:24
|
Jonathan Hitchcock writes: > There is a certain article of faith of mine: > > <Vhata> Spinach: rule #1 for bots > <Spinach> rule #1 for bots is Speak Only When Spoken To This is not always desirable. In some situations you want the bot to respond to anything that looks like a question (like a support channel which is not monitored continuously) or to respond to words (or actions, a feature missing from the original, as I recall). The things should be configurable, not hardwired one way simply because of the way you want it to operate. That's good design. It also reduces the chance of somebody forking the project because you refuse to add stuff they want. > <Spinach> foo =is= baz > <Vhata> Spinach: forget foo [...] > <Vhata> Spinach: foo is also bing [...] > <Spinach> foo =has= nothing on bar; and =is= bar|bing There are times when you want "also" to give bar|bing and times when you want it to behave as the original with "foo is bar and also bing." I hacked the original so that a different keyword gave the | behaviour. I'd suggest "alternatively." People enjoyed the insult server. It's no longer running, but the sources are still available, and it's a simple matter then to run it from the command line. Spell checking is also good. You can also speed up the excuses module a lot (at the expense of some memory. Wrap the subroutine in braces, declare a my(@excuses) array before the subroutine definition so it's static but private (doesn't pollute global namespace), inside the subroutine itself load the array from the excuses file unless @excuses is true, then calculate a random array index based on the size of @excuses and return the appropriate line. IIRC, there are other modules that pollute global namespace in order to have static data which would be better off if converted to use private data. Or maybe you've already done that in your rewrite. If so, I'll teach you how to suck eggs instead. :) -- Paul Allen Softflare Support |