(defun ibot-log-hi (&rest ignore) "Add greeting hi message to ibot." (goto-char (point-min)) (if (re-search-forward (concat "\(<\([^>]*\)>\)[[:space:]]+,say[[:space:]]*\(.*\)") nil t 1) (let ((nick (match-string-no-properties 2)) (erc-hi-text (match-string-no-properties 3)) ) (if (not (string= erc-hi-text "")) (progn (with-temp-buffer (insert-file "~/.emacs.d/erc-hi.txt") (goto-char (point-min)) (replace-regexp (concat "^" nick " :: " "\(.*\)n") "") (write-file "~/.emacs.d/erc-hi.txt") ) (append-to-file (concat nick " :: " erc-hi-text "n") nil "~/.emacs.d/erc-hi.txt") (erc-send-message (concat nick ": SUCCESS! Next login i'll say '" erc-hi-text "' to you!"))) (progn (with-temp-buffer (insert-file "~/.emacs.d/erc-hi.txt") (goto-char (point-min)) (replace-regexp (concat "^" nick " :: " "\(.*\)n") "") (write-file "~/.emacs.d/erc-hi.txt") ) (erc-send-message (concat nick ": Okay! I'll say nothing to you!"))) )))) (add-hook 'erc-insert-post-hook 'ibot-log-hi)