32e1c608e927

Chat event docs.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 12 Aug 2011 20:53:57 -0400
parents d9fe18146e9d
children f03a74a0782c
branches/tags (none)
files docs/source/events.rst

Changes

--- 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))