Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created June 25, 2010 04:32
Show Gist options
  • Select an option

  • Save ldunn/452407 to your computer and use it in GitHub Desktop.

Select an option

Save ldunn/452407 to your computer and use it in GitHub Desktop.
(require :cl-irc)
(defpackage #:litht
(:use #:common-lisp #:cl-irc))
(in-package :litht)
(defvar *connection* nil)
;(defun msg-hook (message)
; (describe message)
; (handler-case
; (let ((connection (connection message)))
; (privmsg *connection* "#bots" "hi!")
; ;(privmsg connection "#bots" (last (ARGUMENTS message))))
; (error (condition) (describe condition)))))
(defun msg-hook (message)
(handler-case
(let ((connection (connection message)))
(describe message)
(privmsg connection "#bots" "hi")))
(privmsg
(and (eq *connection* (connection message)) (connection message))
"#bots" (received-time message)))
(defun connect-bot (hostname nickname channel)
(setf *connection* (irc:connect :nickname nickname
:server hostname))
(sleep 3)
(irc:join *connection* channel)
(irc:add-hook *connection* 'irc-privmsg-message #'msg-hook)
(irc:start-background-message-handler *connection*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment