(defun erc-say-hi (&rest ignore) "when someone join channel, say hi message" (let* ((nick (car (erc-parse-user (erc-response.sender parsed))))) (progn (if (and (string-equal (erc-response.command parsed) "JOIN") (not (string-equal nick (erc-current-nick))) (file-exists-p "~/.emacs.d/erc-hi.txt") ) (let* ((erc-say-hi (with-temp-buffer (insert-file "~/.emacs.d/erc-hi.txt") (goto-char (point-min)) (if (re-search-forward (concat "^" nick " :: " "\(.*\)") nil t 1) (concat (match-string-no-properties 1)) )))) (if erc-say-hi (erc-send-message (concat nick ": " erc-say-hi)))))))) (add-hook 'erc-channel-members-changed-hook 'erc-say-hi)