From 58f698906747f5285ce6f6344eea96e05a6931a6 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Fri, 4 Oct 2019 13:16:33 -0500 Subject: Clean: *room-id* special var refactoring handle-event generic This addresses the conversation in issue #1. I went ahead and created the readme file to document the `*room-id*` variable. Also this commit removes the hardcoded value for the roshamo example bot, and provides a function to create and login your roshambot instead. --- README.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.org (limited to 'README.org') diff --git a/README.org b/README.org new file mode 100644 index 0000000..0c5c20d --- /dev/null +++ b/README.org @@ -0,0 +1,18 @@ +* Granolin + +Build better bots, for matrix! + +* Event Handlers +** Special Variables +*** *room-id* + +The special variable =*room-id*= is available in your =handle-event= methods. +It will have the value of the Matrix room id in which the event occured. It +will be =nil= if the event is not a room state nor timeline/message event. + +For example: + +#+begin_src common-lisp +(defmethod handle-event :after ((cli echo-bot) (ev text-message-event)) + (send-text-message cli *room-id* (msg-body ev))) +#+end_src -- cgit v1.2.3