# HG changeset patch # User Steve Losh # Date 1313196837 14400 # Node ID 32e1c608e92749a77acd15fe1d4b91df07942517 # Parent d9fe18146e9d3ead73e1a86acf777ec2eff58a00 Chat event docs. diff -r d9fe18146e9d -r 32e1c608e927 docs/source/events.rst --- a/docs/source/events.rst Fri Aug 12 20:47:39 2011 -0400 +++ b/docs/source/events.rst Fri Aug 12 20:53:57 2011 -0400 @@ -40,3 +40,16 @@ [... actions ...]) Chat events are fired when a chat message arrives. + +A few things to note when writing bots for the vanilla server: + +First, a "chat message" includes things like "foo joined/left the game.". You can +parse these and take appropriate action if you like. + +The other important point is that *you will receive your own messages*. If you fire +a chat action you'll get a message back for it! A helpful function to use might be +something like this:: + + (defn message-is-own? [bot message] + (clojure.contrib.string/substring? (str "<" (:username bot) ">") + message))