Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ERC Robot config - IRC bot for Emacs
;;;; ERC Robot
; See http://www.emacswiki.org/emacs/ErcRobot
;
; On first installing Aquamacs, do the following 4 steps to install erc-robot,
; then just paste this entire gist at the bottom of your .emacs
; cd ~/Library/Application\ Support/Aquamacs\ Emacs/
; mkdir site-lisp
; cd site-lisp
; wget http://www.emacswiki.org/emacs/erc-robot.el
(load-library "erc-robot")
(add-hook 'erc-server-PRIVMSG-functions 'erc-robot-remote t)
(add-hook 'erc-send-completed-hook 'erc-robot-local t)
(setq erc-robot-commands
'(
("help" t (lambda (args)
(concat "commands available: "
(mapconcat
(lambda (e)
(car e))
erc-robot-commands " "))))
;("hello" t (lambda (args) "hello to you too !"))
;("zippy" t (lambda (args) (erc-replace-regexp-in-string "\n" " " (yow))))
;("doctor" t erc-cmd-DOCTOR)
;("echo" t (lambda (args) args))
("version" t (lambda (args) (erc-version)))
("fortune" t (lambda (args)
(require 'fortune)
(fortune-in-buffer nil)
(let ((f (get-buffer fortune-buffer-name)))
(if f
(progn
(set-buffer f)
(erc-replace-regexp-in-string
"\n" " " (buffer-substring (point-min)
(point-max))))
"no fortunes!"))))
;; Subversion status
("info" t (lambda (args) (shell-command-to-string "svn info ~/Sites/zepinvest/branches/v1.3.0 | grep -iE \"(Revision|Path)\" | perl -pe \"chomp if eof\"")))
("st" t (lambda (args) (concat (shell-command-to-string "svn st ~/Sites/zepinvest/branches/v1.3.0 | wc -l | perl -pe \"s/\s+//; chomp\"") " files with local modifications.")))
;; Environment status
;; Gem list
;; Splits the message into parts when it is longer than the max IRC message length,
("gems" t (lambda (args) (shell-command-to-string "gem list | perl -wnl -e \"$\\ = ($. % 10 == 0 ? qq{\n} : qq{ }) ;print;\"")))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment