anchor.diff:    nil)
   
   (defmethod manage-intermittent-task ((bot microblog-bot))
  -  "Run the task or update the wait time."  
  +  "Run the task or update the wait time."
  +  (debug-msg "Wait remaining for bot ~a is ~a" bot (wait-remaining bot))
     (if (<= (wait-remaining bot) 0)
  -      (progn
  -	(ignore-errors
  -	    (intermittent-task bot))
  -	(reset-wait bot)))
  -  (setf (wait-remaining bot)
  -	(- (wait-remaining bot)
  -	   *bot-sleep-time*)))
  +      (handler-case
  +	  (progn
  +	    (intermittent-task bot)
  +	    (reset-wait bot))
  +	(error (err) 
  +	  (report-error "~a - ~a~%" bot err)))
  +      (setf (wait-remaining bot)
  +	    (- (wait-remaining bot)
  +	       *bot-sleep-time*))))
   
   (defmethod run-bot-once ((bot microblog-bot))
  -  (ignore-errors
  -       (with-microblog-user bot
  -	 (manage-daily-task bot)
  -	 (constant-task bot)
  -	 (respond-to-mentions bot)
  -	 (manage-intermittent-task bot))))
  +  (debug-msg "Running bot once ~a" bot)
  +  (handler-case
  +      (with-microblog-user bot
  +	(manage-daily-task bot)
  +	(constant-task bot)
  +	(respond-to-mentions bot)
  +	(manage-intermittent-task bot))
  +    (error (err) 
  +      (report-error "~a - ~a~%" bot err))))
   
   (defmethod run-bot ((bot microblog-bot))
     "Loop forever responding to mentions & occasionaly performing periodic-task."
  
positive.code: 			   :initarg :most-recent-mention-id 
  			   :initform 0)))
  
  (defvar *live* t)
  
  (defmacro with-microblog-user (user &body body)
    "Log in, execture the body, log out."
    `(progn
       (cl-twit:with-session ((user-nickname ,user) 
  			    (user-password ,user) 
  			    :authenticatep t)
         ,@body)
       ;; with-session doesn't currently do this, remove if it ever does.
       (cl-twit:logout)))
  
  (defmacro update-id (place item)
    "Change the id at place for item's id if higher"
    (let ((new-id (gensym)))
      `(let ((,new-id (cl-twit::id ,item))) 
         (when (> ,new-id ,place)
  	 (setf ,place ,new-id)))))
  
  (defun post (message)
    (cl-twit:update message))
  
  (defun set-debug ()
    (setf *live* nil)
    (setf (symbol-function 'post) #'(lambda(message)
  				    (format t "~a~%" message))))
  
  (defun set-live ()
    (setf *live* t)
    (setf (symbol-function 'post) #'(lambda (message)
  	       (cl-twit:update message))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Basic bot
  ;; TODO Split out into constant and intermittent bots, or tasks for a bot?
  ;; Tasks are probably best
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
  (defconstant %one-hour (* 60 60)
    "One hour in seconds")
  
  (defconstant %one-day (* %one-hour 24)
    "One day in seconds")
  
  (defvar *bot-sleep-time* (* 60 5)
    "How long to wait between each check")
  
  (defclass microblog-bot (microblog-user)
    ((wait-remaining :accessor wait-remaining 
  
negative.code: 		 :initform 0)
     (min-wait :accessor min-wait 
  	     :initarg :min-wait
  	     :initform *min-wait-time*)
     (max-wait :accessor max-wait 
  	     :initarg :max-wait 
  	     :initform *max-wait-time*)
     (daily-task-hour :accessor daily-task-hour
  		    :initarg :daily-task-hour 
  		    :initform 0)   
  