anchor.diff:      (ql:quickload :cl-irc)
       (ql:quickload :cl+ssl)
       (ql:quickload :split-sequence)
  -    (ql:quickload :trivial-shell)))
  +    (ql:quickload :trivial-shell)
  +    (ql:quickload :swank)))
   
   (defpackage :lispbot (:use :common-lisp :irc :cl+ssl :split-sequence)
   	    (:export #:run #:part))
  
positive.code:     (irc:quit *connection*)
      (setf *connection* nil)))
  
  ;; a "hook" is some sort of function that we run in response to an event
  ;; this one happens to take one parameter that is filled in with a message by cl-irc
  (defun message-received-hook (message)
  
negative.code:     (format t "The sender of the message is: ~a~%" sender)
      (when (search *nick* head)
        (fn-case (first body) #'string=
  	("foo"
  	 (irc:privmsg *connection* channel (format nil "foo to YOU, ~A!" sender)))
  	("drop"
  	 (if *gonna-quit*
  	     (part)
  	     (progn
  	       (setf *gonna-quit* t)
  	       (irc:privmsg *connection* channel (format nil "NOT YET")))))
  	("source"
  	 (irc:privmsg *connection* channel "https://github.com/fouric/lispbot"))
  	;; this line will cause the bot to reply to whoever said "hello" to it
  	("hello"
  	 (let ((string-to-send (format nil "Hello, ~A!" sender)))
  	   ;; make the string lowercase so that we don't have to use lowercase ourselves
  	   (irc:privmsg *connection* sender string-to-send)))))))
  
  (random 10000)
  
  (defmacro continuable (&body body)
    `(restart-case
         (progn ,@body)
       (continue () :report "Continue")))
  
  (defun update-swank ()
    (continuable
      (let ((connection (or swank::*emacs-connection* (swank::default-connection))))
        (when connection
  	(swank::handle-requests connection t)))))
  
  (let ((random-state (make-random-state t)))
    (random 100000 random-state))
  
  (defun run (&key (channel "#lisp") bot-nick (auth-required nil))
    (setf *nick* (or bot-nick (format nil "lispbot~A"
  				    (let ((random-state (make-random-state t)))
  				      (random 10000 random-state)))))
  