[cl-irc-devel] Feedback from a novice

Ed Symanzik zik at msu.edu
Fri Jul 15 19:12:55 UTC 2005


I'm new to lisp and even newer to cl-irc.

I wanted my bot to take a command to send a message to another
user/channel.  This works great.

(defun msg-hook (message)
  (let* ((connection (connection message))
         (channel (find-channel connection (first (arguments message))))
         (source (source message))
         (text (trailing-argument message)))
    (unless (self-message-p message)


Then I was thinking, that should be a lot more generic.  Why not give it
_any_ irc command; join, kick, action, etc.

First problem was that there is no action command.  *bot wimpers

(defmethod action ((connection connection) (target string) (message string))
  (send-irc-message connection :privmsg
                    (make-ctcp-message (concatenate 'string "ACTION "
message))
                    target))

(defmethod action ((connection connection) (user user) (message string))
  (action connection (nickname user) message))

(defmethod action ((connection connection) (channel channel) (message
string))
  (action connection (name channel) message))


That works well too.  But how to give the bot a generic command and
execute it?

It looks like

(cl-ppcre:register-groups-bind (target string)
                               ("^!(.*)" command)
                               (create-irc-message command))

but how do I send a message?  Maybe something like:

(defmethod send-irc-message ((connection connection) (message message))
   ...

Btw, I was surprized to find that the read-message method doesn't just
read a string, parse it, and return a message; it also dispatches events.


Again, I'm just a noob but I thought I would through in some feedback
anyway.  I'm hoping I was just clueless and all of this is already in there.

*zik waits to be beaten with a stick



More information about the cl-irc-devel mailing list